-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
81 lines (63 loc) · 2.43 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2023/7/13 22:58
# @Author : xiepulin
# @File : setup.py
# @Software: PyCharm
"""Setup the GeneMiner environment."""
# Test pip
# 1) Clean the /dist directory
# 2) python3 setup.py sdist bdist_wheel
# 3) pip install --index-url https://test.pypi.org/simple/
# --extra-index-url https://pypi.org/simple
# 4) twine upload --repository-url https://test.pypi.org/legacy/ dist/*
import platform
import sys
import setuptools
from setuptools import setup
'''compare version'''
def compare_version(a: str, b: str):
lena = len(a.split('.')) # Get the components of the version string
lenb = len(b.split('.'))
a2 = a + '.0' * (lenb-lena) # Completing a when b is longer than a
b2 = b + '.0' * (lena-lenb)
for i in range(max(lena, lenb)): # To compare each part, you need to convert to integers for comparison
if int(a2.split('.')[i]) > int(b2.split('.')[i]):
return 1
elif int(a2.split('.')[i]) < int(b2.split('.')[i]):
return 0
else: # If they are equal at the end of the comparison, the first version is returned
if i == max(lena, lenb)-1:
return 1
# python libs
install_dependencies = []
try:
import Bio
biopython_current=Bio.__version__
biopython_requirement="1.70"
flag=compare_version(biopython_current, biopython_requirement)
if not flag:
install_dependencies.append("biopython>=1.70")
except ImportError:
install_dependencies.append("biopython>=1.70")
else:
sys.stdout.write("Existed module biopython " + str(Bio.__version__) + "\n")
sys.stdout.write("Python " + str(sys.version).replace("\n", " ") + "\n")
sys.stdout.write("PLATFORM: " + " ".join(platform.uname()) + "\n")
sys.stdout.write("Using setuptools " + str(setuptools.__version__) + "\n")
scripts_to_install = ["geneminer.py"]
setup(
name="GeneMiner",
version="1.1",
author="xiepulin",
author_email="yyu@scu.edu.cn , happywithxpl@126.com",
description="""GeneMiner : a tool for extracting phylogenetic markers from next-generation sequencing data""",
license="GPL-3.0 license",
# Project home
url="https://github.com/happywithxpl/GeneMiner",
python_requires='>=3.6',
install_requires=install_dependencies,
scripts=scripts_to_install,
packages=["lib"],
zip_safe=False
)