Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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