Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 447 lines (396 sloc) 13.248 kb
22df84e Updated setup.py for GenBank
chapmanb authored
1 """Distutils based setup script for Biopython.
2
3 This uses Distutils (http://python.org/sigs/distutils-sig/) the standard
4 python mechanism for installing packages. For the easiest installation
5 just type the command:
6
7 python setup.py install
8
9 For more in-depth instructions, see the installation section of the
b4379ed @peterjc Dropping support for Python 2.3
peterjc authored
10 Biopython manual, linked to from:
22df84e Updated setup.py for GenBank
chapmanb authored
11
e4e4dc4 @peterjc Updating the documentation URL
peterjc authored
12 http://biopython.org/wiki/Documentation
22df84e Updated setup.py for GenBank
chapmanb authored
13
14 Or for more details about the options available from distutils, look at
15 the 'Installing Python Modules' distutils documentation, available from:
16
17 http://python.org/sigs/distutils-sig/doc/
18
0277345 @peterjc Clarify the mailing list bit
peterjc authored
19 Or, if all else fails, feel free to write to the sign up to the Biopython
e4e4dc4 @peterjc Updating the documentation URL
peterjc authored
20 mailing list and ask for help. See:
21
22 http://biopython.org/wiki/Mailing_lists
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
23 """
f726249 merged Andrew's Seq package with the tree
jchang authored
24 import sys
96a6095 Upgrade setup.py for SubsMat
chapmanb authored
25 import os
1eeed11 @peterjc Call 2to3 from setup.py on Python 3 (like NumPy)
peterjc authored
26 import shutil
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
27
2a26cee @peterjc Modify setup.py to work on PyPy 1.6 (and ignore micronumpy)
peterjc authored
28 def is_pypy():
29 import platform
30 try:
31 if platform.python_implementation()=='PyPy':
32 return True
33 except AttributeError:
34 #New in Python 2.6, not in Jython yet either
35 pass
36 return False
37
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
38 def get_yes_or_no(question, default):
39 if default:
40 option_str = "(Y/n)"
41 default_str = 'y'
42 else:
43 option_str = "(y/N)"
44 default_str = 'n'
45
e4e4dc4 @peterjc Updating the documentation URL
peterjc authored
46 while True:
adcfd49 @peterjc Tweak the setup.py y/n prompt to look sensible on Python 2.7
peterjc authored
47 print ("%s %s:" % (question, option_str))
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
48 if sys.version_info[0] == 3:
49 response = input().lower()
50 else:
51 response = raw_input().lower()
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
52 if not response:
53 response = default_str
54 if response[0] in ['y', 'n']:
55 break
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
56 print ("Please answer y or n.")
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
57 return response[0] == 'y'
58
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
59 # Make sure I have the right Python version.
1975c3a @peterjc Officially ending support for Python 2.4
peterjc authored
60 if sys.version_info[:2] < (2, 5):
61 print ("Biopython requires Python 2.5 or better (but not Python 3 " \
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
62 + "yet). Python %d.%d detected" % sys.version_info[:2])
63 sys.exit(-1)
64 elif sys.version_info[0] == 3:
1eeed11 @peterjc Call 2to3 from setup.py on Python 3 (like NumPy)
peterjc authored
65 print("WARNING - Biopython does not yet officially support Python 3")
66 import do2to3
67 python3_source = "build/py%i.%i" % sys.version_info[:2]
68 if "clean" in sys.argv:
69 if os.path.isdir(python3_source):
70 shutil.rmtree(python3_source)
71 del python3_source #so we don't try to change to it below
72 else:
73 if not os.path.isdir("build"):
74 os.mkdir("build")
75 do2to3.main(".", python3_source)
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
76
77 # use setuptools, falling back on core modules if not found
78 try:
79 from setuptools import setup, Command
80 from setuptools.command.install import install
81 from setuptools.command.build_py import build_py
82 from setuptools.command.build_ext import build_ext
83 from setuptools.extension import Extension
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
84 _SETUPTOOLS = True
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
85 except ImportError:
86 from distutils.core import setup
87 from distutils.core import Command
88 from distutils.command.install import install
89 from distutils.command.build_py import build_py
90 from distutils.command.build_ext import build_ext
91 from distutils.extension import Extension
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
92 _SETUPTOOLS = False
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
93
a8ae40f now installs Martel and doesn't complain about it
jchang authored
94 _CHECKED = None
95 def check_dependencies_once():
96 # Call check_dependencies, but cache the result for subsequent
97 # calls.
98 global _CHECKED
99 if _CHECKED is None:
100 _CHECKED = check_dependencies()
101 return _CHECKED
102
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
103 def get_install_requires():
104 install_requires = []
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
105 # skip this with distutils (otherwise get a warning)
106 if not _SETUPTOOLS:
107 return []
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
108 # skip this with jython and pypy
109 if os.name=="java" or is_pypy():
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
110 return []
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
111 # check for easy_install and pip
112 is_automated = False
113 # easy_install: --dist-dir option passed
114 try:
115 dist_dir_i = sys.argv.index("--dist-dir")
116 except ValueError:
117 dist_dir_i = None
118 if dist_dir_i is not None:
119 dist_dir = sys.argv[dist_dir_i+1]
4f96917 @chapmanb Eric's suggestions to generalize easy_install/pip detection
chapmanb authored
120 if "egg-dist-tmp" in dist_dir:
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
121 is_automated = True
122 # pip -- calls from python directly with "-c"
123 if sys.argv in [["-c", "develop", "--no-deps"],
4f96917 @chapmanb Eric's suggestions to generalize easy_install/pip detection
chapmanb authored
124 ["--no-deps", "-c", "develop"],
5b12cfd @chapmanb Add numpy as required library and skip check with automated installs …
chapmanb authored
125 ["-c", "egg_info"]]:
126 is_automated = True
127 if is_automated:
128 global _CHECKED
129 if _CHECKED is None: _CHECKED = True
130 install_requires.append("numpy >= 1.5.1")
131 return install_requires
132
a8ae40f now installs Martel and doesn't complain about it
jchang authored
133 def check_dependencies():
134 """Return whether the installation should continue."""
135 # There should be some way for the user to tell specify not to
136 # check dependencies. For example, it probably should not if
137 # the user specified "-q". However, I'm not sure where
138 # distutils stores that information. Also, install has a
139 # --force option that gets saved in self.user_options. It
140 # means overwrite previous installations. If the user has
141 # forced an installation, should we also ignore dependencies?
7452113 @peterjc Simplify the dependency checking code since we only care about NumPy,…
peterjc authored
142
143 # We only check for NumPy, as this is a compile time dependency
144 if is_Numpy_installed() : return True
0627102 @peterjc Don't nag Jython users about NumPy not being installed. Fix from Kyle…
peterjc authored
145
146 if os.name=='java':
147 return True #NumPy is not avaliable for Jython (for now)
2a26cee @peterjc Modify setup.py to work on PyPy 1.6 (and ignore micronumpy)
peterjc authored
148 if is_pypy():
149 return True #Full NumPy not available for PyPy (for now)
0627102 @peterjc Don't nag Jython users about NumPy not being installed. Fix from Kyle…
peterjc authored
150
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
151 print ("""
7452113 @peterjc Simplify the dependency checking code since we only care about NumPy,…
peterjc authored
152 Numerical Python (NumPy) is not installed.
153
a8ae40f now installs Martel and doesn't complain about it
jchang authored
154 This package is required for many Biopython features. Please install
7452113 @peterjc Simplify the dependency checking code since we only care about NumPy,…
peterjc authored
155 it before you install Biopython. You can install Biopython anyway, but
156 anything dependent on NumPy will not work. If you do this, and later
157 install NumPy, you should then re-install Biopython.
158
159 You can find NumPy at http://numpy.scipy.org
942ef84 @tiagoantao setup.py is now Python 3 aware
tiagoantao authored
160 """)
7452113 @peterjc Simplify the dependency checking code since we only care about NumPy,…
peterjc authored
161 # exit automatically if running as part of some script
162 # (e.g. PyPM, ActiveState's Python Package Manager)
163 if not sys.stdout.isatty() :
164 sys.exit(-1)
165 # We can ask the user
166 return get_yes_or_no("Do you want to continue this installation?", False)
a8ae40f now installs Martel and doesn't complain about it
jchang authored
167
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
168 class install_biopython(install):
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
169 """Override the standard install to check for dependencies.
170
171 This will just run the normal install, and then print warning messages
172 if packages are missing.
b7761b6 Fixes to imported EUtils to get it working happily with Bio:
chapmanb authored
173
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
174 """
4e4c3aa @chapmanb Add support for single-version-externally-managed flag which pip asks…
chapmanb authored
175 # Adds support for the single-version-externally-managed flag
176 # which is present in setuptools but not distutils. pip requires it.
177 # In setuptools this forces installation the "old way" which we
178 # only support here, so we just make it a no-op.
179 user_options = install.user_options + [
180 ('single-version-externally-managed', None,
181 "used by system package builders to create 'flat' eggs"),
182 ]
183 boolean_options = install.boolean_options + [
184 'single-version-externally-managed',
185 ]
186 def initialize_options(self):
187 install.initialize_options(self)
188 self.single_version_externally_managed = None
189
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
190 def run(self):
a8ae40f now installs Martel and doesn't complain about it
jchang authored
191 if check_dependencies_once():
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
192 # Run the normal install.
193 install.run(self)
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
194
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
195 class build_py_biopython(build_py):
196 def run(self):
a8ae40f now installs Martel and doesn't complain about it
jchang authored
197 if not check_dependencies_once():
198 return
593e65e Added Affymetrix package from Harry Zuzan
chapmanb authored
199 # Add software that requires Numpy to be installed.
a8ae40f now installs Martel and doesn't complain about it
jchang authored
200 if is_Numpy_installed():
593e65e Added Affymetrix package from Harry Zuzan
chapmanb authored
201 self.packages.extend(NUMPY_PACKAGES)
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
202 build_py.run(self)
fc90717 Whew, final thing to add! Added code for displaying pretty pictures u…
chapmanb authored
203
94b412a See bug #2375. Copy data files to the build directory, so the tests run
mdehoon authored
204
a8ae40f now installs Martel and doesn't complain about it
jchang authored
205 class build_ext_biopython(build_ext):
206 def run(self):
207 if not check_dependencies_once():
208 return
209 build_ext.run(self)
210
a151e5c workaround for bug in distutils that prevents one from compiling both…
grouse authored
211
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
212 class test_biopython(Command):
b50486d Allow setup.py to be able to run tests with python setup.py test
chapmanb authored
213 """Run all of the tests for the package.
214
215 This is a automatic test run class to make distutils kind of act like
216 perl. With this you can do:
217
218 python setup.py build
219 python setup.py install
220 python setup.py test
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
221
b50486d Allow setup.py to be able to run tests with python setup.py test
chapmanb authored
222 """
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
223 description = "Automatically run the test suite for Biopython."
844496e @peterjc Removing the now redundant --no-gui argument for the test suite.
peterjc authored
224 user_options = []
1d16b65 The modification to setup.py gives the option of --no-gui for the com…
lasher authored
225
226 def initialize_options(self):
844496e @peterjc Removing the now redundant --no-gui argument for the test suite.
peterjc authored
227 pass
1d16b65 The modification to setup.py gives the option of --no-gui for the com…
lasher authored
228
229 def finalize_options(self):
b50486d Allow setup.py to be able to run tests with python setup.py test
chapmanb authored
230 pass
1d16b65 The modification to setup.py gives the option of --no-gui for the com…
lasher authored
231
b50486d Allow setup.py to be able to run tests with python setup.py test
chapmanb authored
232 def run(self):
233 this_dir = os.getcwd()
234
235 # change to the test dir and run the tests
236 os.chdir("Tests")
b720e3d In Python 2.3.2, the current directory '' is not included in the path.
grouse authored
237 sys.path.insert(0, '')
844496e @peterjc Removing the now redundant --no-gui argument for the test suite.
peterjc authored
238 import run_tests
239 run_tests.main([])
b50486d Allow setup.py to be able to run tests with python setup.py test
chapmanb authored
240
241 # change back to the current directory
242 os.chdir(this_dir)
243
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
244 def can_import(module_name):
245 """can_import(module_name) -> module or None"""
246 try:
247 return __import__(module_name)
248 except ImportError:
249 return None
250
251 def is_Numpy_installed():
2a26cee @peterjc Modify setup.py to work on PyPy 1.6 (and ignore micronumpy)
peterjc authored
252 if is_pypy():
253 return False
7452113 @peterjc Simplify the dependency checking code since we only care about NumPy,…
peterjc authored
254 return bool(can_import("numpy"))
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
255
7db13b0 Updated to check for dependencies and print out warnings and to insta…
chapmanb authored
256 # --- set up the packages we are going to install
257 # standard biopython packages
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
258 PACKAGES = [
259 'Bio',
260 'Bio.Align',
32c4f4b @peterjc Adding wrapper from Cymon Cox for the MUSCLE alignment tool, with bas…
peterjc authored
261 'Bio.Align.Applications',
1231257 @peterjc Include Bio.AlignIO in installation
peterjc authored
262 'Bio.AlignIO',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
263 'Bio.Alphabet',
264 'Bio.Application',
265 'Bio.Blast',
0cd0e9c Modified Files:
idoerg authored
266 'Bio.CAPS',
76ce5ca Added Compass parsing code contributed by James Casbon.
chapmanb authored
267 'Bio.Compass',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
268 'Bio.Crystal',
269 'Bio.Data',
270 'Bio.Emboss',
8521e25 Moving Bio/Entrez.py to Bio/Entrez/__init__.py.
mdehoon authored
271 'Bio.Entrez',
c23628e Now that Bio/ExPASy.py was replaced by Bio/ExPASy/__init__.py, we nee…
mdehoon authored
272 'Bio.ExPASy',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
273 'Bio.FSSP',
274 'Bio.GA',
275 'Bio.GA.Crossover',
276 'Bio.GA.Mutation',
277 'Bio.GA.Repair',
278 'Bio.GA.Selection',
279 'Bio.GenBank',
280 'Bio.Geo',
281 'Bio.Graphics',
cace008 @peterjc Initial check in of GenomeDiagram by Leighton Pritchard, converted fo…
peterjc authored
282 'Bio.Graphics.GenomeDiagram',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
283 'Bio.HMM',
284 'Bio.KEGG',
285 'Bio.KEGG.Compound',
286 'Bio.KEGG.Enzyme',
287 'Bio.KEGG.Map',
288 'Bio.Medline',
9deacf3 added Bio.Motif to setup.py
bartek authored
289 'Bio.Motif',
fc68931 @peterjc Need to install Bio.Motif.PArsers
peterjc authored
290 'Bio.Motif.Parsers',
594a86a @peterjc Include Bio.Motif.Applications module
peterjc authored
291 'Bio.Motif.Applications',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
292 'Bio.NeuralNetwork',
293 'Bio.NeuralNetwork.BackPropagation',
294 'Bio.NeuralNetwork.Gene',
c2c11a9 Biopython now works with Python >= 2.3
idoerg authored
295 'Bio.Nexus',
7bcfbce Adding NMR files kindly contributed by Bob Bussell
chapmanb authored
296 'Bio.NMR',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
297 'Bio.Parsers',
298 'Bio.Pathway',
299 'Bio.Pathway.Rep',
300 'Bio.PDB',
983daba Add Bio.PDB.mmCIF (but not MMFIFlex) as a module to make sure that
mdehoon authored
301 'Bio.PDB.mmCIF',
4f07b8a Added Bio.PopGen module by Tiago Antao.
mdehoon authored
302 'Bio.PopGen',
303 'Bio.PopGen.Async',
304 'Bio.PopGen.FDist',
305 'Bio.PopGen.GenePop',
96f01d5 2375: Activating SimCoal on Biopython setup
tiagoantao authored
306 'Bio.PopGen.SimCoal',
05f9ba2 Added Restriction enzyme package contributed by Frederic Sohm. This i…
chapmanb authored
307 'Bio.Restriction',
308 'Bio.Restriction._Update',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
309 'Bio.SCOP',
310 'Bio.SeqIO',
311 'Bio.SeqUtils',
2214cae Added Sequencing directory to packages
chapmanb authored
312 'Bio.Sequencing',
42be9a8 Add Novoalign commandline submitted by Osvaldo Zagordi; Bug 2904
chapmanb authored
313 'Bio.Sequencing.Applications',
7738632 Added Bio.Statistics.
mdehoon authored
314 'Bio.Statistics',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
315 'Bio.SubsMat',
316 'Bio.SVDSuperimposer',
317 'Bio.SwissProt',
eb394c0 @chapmanb Whoops. Revert setup.py to latest version
chapmanb authored
318 'Bio.Phylo',
b22304a @etal Phylo.Applications: Added a PhyML wrapper (Feature #3216)
etal authored
319 'Bio.Phylo.Applications',
9531507 @peterjc Must install new PAML module
peterjc authored
320 'Bio.Phylo.PAML',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
321 'Bio.UniGene',
3a5d550 Adding Bio.Wise to the distribution
grouse authored
322 'Bio.Wise',
d81c27e @peterjc Removed the Martel special case code (it should be safe to assume tha…
peterjc authored
323 #Other top level packages,
324 'BioSQL',
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
325 ]
326
593e65e Added Affymetrix package from Harry Zuzan
chapmanb authored
327 # packages that require Numeric Python
328 NUMPY_PACKAGES = [
329 'Bio.Affy',
330 'Bio.Cluster',
379fbb7 Switched from the old Numerical Python to the new NumPy. Bio.KDTree i…
mdehoon authored
331 'Bio.KDTree',
593e65e Added Affymetrix package from Harry Zuzan
chapmanb authored
332 ]
333
ae19435 @peterjc Fix from Kyle Ellrott to get setup.py to work on Jython 2.5.0 by not …
peterjc authored
334 if os.name == 'java' :
335 # Jython doesn't support C extensions
336 EXTENSIONS = []
2a26cee @peterjc Modify setup.py to work on PyPy 1.6 (and ignore micronumpy)
peterjc authored
337 elif is_pypy():
338 # Skip C extensions for now
339 EXTENSIONS = []
f048890 @peterjc Update setup.py to make testing with 2to3 easier
peterjc authored
340 elif sys.version_info[0] == 3:
341 # TODO - Must update our C extensions for Python 3
9b58027 Updating cpairwise2module for Python 3. This module could use some fu…
Michiel de Hoon authored
342 EXTENSIONS = [
343 Extension('Bio.cpairwise2',
344 ['Bio/cpairwise2module.c'],
345 include_dirs=["Bio"]
346 ),
234fb50 modified Bio.Nexus.cnexus for Python 3
Michiel de Hoon authored
347 Extension('Bio.Nexus.cnexus',
348 ['Bio/Nexus/cnexus.c']
349 ),
9b58027 Updating cpairwise2module for Python 3. This module could use some fu…
Michiel de Hoon authored
350 ]
ae19435 @peterjc Fix from Kyle Ellrott to get setup.py to work on Jython 2.5.0 by not …
peterjc authored
351 else :
352 EXTENSIONS = [
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
353 Extension('Bio.cpairwise2',
c21a741 Put csupport in the pairwise2 module, as currently it is not used any…
Michiel de Hoon authored
354 ['Bio/cpairwise2module.c'],
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
355 include_dirs=["Bio"]
356 ),
357 Extension('Bio.trie',
358 ['Bio/triemodule.c',
359 'Bio/trie.c'],
360 include_dirs=["Bio"]
361 ),
844496e @peterjc Removing the now redundant --no-gui argument for the test suite.
peterjc authored
362 #Commented out due to the build dependency on flex, see Bug 2619
363 # Extension('Bio.PDB.mmCIF.MMCIFlex',
364 # ['Bio/PDB/mmCIF/lex.yy.c',
365 # 'Bio/PDB/mmCIF/MMCIFlexmodule.c'],
366 # include_dirs=["Bio"],
367 # libraries=["fl"]
368 # ),
2800c6c *** empty log message ***
idoerg authored
369 Extension('Bio.Nexus.cnexus',
c2c11a9 Biopython now works with Python >= 2.3
idoerg authored
370 ['Bio/Nexus/cnexus.c']
371 ),
fdcb82e added code so that it now checks for dependencies before biopython is
jchang authored
372 ]
373
48d1716 @peterjc Seems must define list of extensions earlier for them to be installed…
peterjc authored
374 #Add extensions that requires NumPy to build
375 if is_Numpy_installed():
376 import numpy
377 numpy_include_dir = numpy.get_include()
378 EXTENSIONS.append(
379 Extension('Bio.Cluster.cluster',
380 ['Bio/Cluster/clustermodule.c',
381 'Bio/Cluster/cluster.c'],
382 include_dirs=[numpy_include_dir],
383 ))
384 EXTENSIONS.append(
385 Extension('Bio.KDTree._CKDTree',
386 ["Bio/KDTree/KDTree.c",
387 "Bio/KDTree/KDTreemodule.c"],
388 include_dirs=[numpy_include_dir],
389 ))
390 EXTENSIONS.append(
391 Extension('Bio.Motif._pwm',
392 ["Bio/Motif/_pwm.c"],
393 include_dirs=[numpy_include_dir],
394 ))
395
ae19435 @peterjc Fix from Kyle Ellrott to get setup.py to work on Jython 2.5.0 by not …
peterjc authored
396
839c345 @peterjc Adding Bio.__version__ and using this in setup.py automatically. The…
peterjc authored
397 #We now define the Biopython version number in Bio/__init__.py
398 #Here we can't use "import Bio" then "Bio.__version__" as that would
399 #tell us the version of Biopython already installed (if any).
400 __version__ = "Undefined"
401 for line in open('Bio/__init__.py'):
402 if (line.startswith('__version__')):
403 exec(line.strip())
404
1eeed11 @peterjc Call 2to3 from setup.py on Python 3 (like NumPy)
peterjc authored
405 #Simple trick to use the 2to3 converted source under Python 3,
406 #change the current directory before/after running setup.
407 #Note as a side effect there will be a build folder underneath
408 #the python3_source folder.
409 old_path = os.getcwd()
410 try:
411 src_path = python3_source
412 except NameError:
413 src_path = os.path.dirname(os.path.abspath(sys.argv[0]))
414 os.chdir(src_path)
415 sys.path.insert(0, src_path)
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
416
417 setup_args = {
418 "name" : 'biopython',
419 "version" : __version__,
420 "author" : 'The Biopython Consortium',
421 "author_email" : 'biopython@biopython.org',
422 "url" : 'http://www.biopython.org/',
423 "description" : 'Freely available tools for computational molecular biology.',
424 "download_url" : 'http://biopython.org/DIST/',
425 "cmdclass" : {
426 "install" : install_biopython,
427 "build_py" : build_py_biopython,
428 "build_ext" : build_ext_biopython,
429 "test" : test_biopython,
430 },
431 "packages" : PACKAGES,
432 "ext_modules" : EXTENSIONS,
433 "package_data" : {
434 'Bio.Entrez': ['DTDs/*.dtd', 'DTDs/*.ent', 'DTDs/*.mod'],
435 'Bio.PopGen': ['SimCoal/data/*.par'],
436 },
437 }
438
439 if _SETUPTOOLS:
440 setup_args["install_requires"] = get_install_requires()
441
1eeed11 @peterjc Call 2to3 from setup.py on Python 3 (like NumPy)
peterjc authored
442 try:
78b965f @peterjc Only pass install_requires to setup with setuptools, not distutils
peterjc authored
443 setup(**setup_args)
1eeed11 @peterjc Call 2to3 from setup.py on Python 3 (like NumPy)
peterjc authored
444 finally:
445 del sys.path[0]
446 os.chdir(old_path)
Something went wrong with that request. Please try again.