Back to index

python-biopython  1.60
Classes | Functions | Variables
setup Namespace Reference

Classes

class  install_biopython
class  build_py_biopython
class  build_ext_biopython
class  test_biopython

Functions

def is_pypy
def get_yes_or_no
def check_dependencies_once
def get_install_requires
def check_dependencies
def can_import
def is_Numpy_installed

Variables

string python3_source = "build/py%i.%i"
 _SETUPTOOLS = True
 _CHECKED = None
list PACKAGES
list NUMPY_PACKAGES
list EXTENSIONS = []
tuple numpy_include_dir = numpy.get_include()
list include_dirs = [numpy_include_dir]
string __version__ = "Undefined"
tuple old_path = os.getcwd()
 src_path = python3_source
dictionary setup_args

Detailed Description

Distutils based setup script for Biopython.

This uses Distutils (http://python.org/sigs/distutils-sig/) the standard
python mechanism for installing packages. For the easiest installation
just type the command:

python setup.py install

For more in-depth instructions, see the installation section of the
Biopython manual, linked to from:

http://biopython.org/wiki/Documentation

Or for more details about the options available from distutils, look at
the 'Installing Python Modules' distutils documentation, available from:

http://python.org/sigs/distutils-sig/doc/

Or, if all else fails, feel free to write to the sign up to the Biopython
mailing list and ask for help.  See:

http://biopython.org/wiki/Mailing_lists

Function Documentation

def setup.can_import (   module_name)
can_import(module_name) -> module or None

Definition at line 244 of file setup.py.

00244 
00245 def can_import(module_name):
00246     """can_import(module_name) -> module or None"""
00247     try:
00248         return __import__(module_name)
00249     except ImportError:
00250         return None

Here is the caller graph for this function:

Return whether the installation should continue.

Definition at line 133 of file setup.py.

00133 
00134 def check_dependencies():
00135     """Return whether the installation should continue."""
00136     # There should be some way for the user to tell specify not to
00137     # check dependencies.  For example, it probably should not if
00138     # the user specified "-q".  However, I'm not sure where
00139     # distutils stores that information.  Also, install has a
00140     # --force option that gets saved in self.user_options.  It
00141     # means overwrite previous installations.  If the user has
00142     # forced an installation, should we also ignore dependencies?
00143 
00144     # We only check for NumPy, as this is a compile time dependency
00145     if is_Numpy_installed() : return True
00146 
00147     if os.name=='java':
00148         return True #NumPy is not avaliable for Jython (for now)
00149     if is_pypy():
00150         return True #Full NumPy not available for PyPy (for now)
00151 
00152     print ("""
00153 Numerical Python (NumPy) is not installed.
00154 
00155 This package is required for many Biopython features.  Please install
00156 it before you install Biopython. You can install Biopython anyway, but
00157 anything dependent on NumPy will not work. If you do this, and later
00158 install NumPy, you should then re-install Biopython.
00159 
00160 You can find NumPy at http://numpy.scipy.org
00161 """)
00162     # exit automatically if running as part of some script
00163     # (e.g. PyPM, ActiveState's Python Package Manager)
00164     if not sys.stdout.isatty() :
00165         sys.exit(-1)
00166     # We can ask the user
00167     return get_yes_or_no("Do you want to continue this installation?", False)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 95 of file setup.py.

00095 
00096 def check_dependencies_once():
00097     # Call check_dependencies, but cache the result for subsequent
00098     # calls.
00099     global _CHECKED
00100     if _CHECKED is None:
00101         _CHECKED = check_dependencies()
00102     return _CHECKED

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 103 of file setup.py.

00103 
00104 def get_install_requires():
00105     install_requires = []
00106     # skip this with distutils (otherwise get a warning)
00107     if not _SETUPTOOLS:
00108         return []
00109     # skip this with jython and pypy
00110     if os.name=="java" or is_pypy():
00111         return []
00112     # check for easy_install and pip
00113     is_automated = False
00114     # easy_install: --dist-dir option passed
00115     try:
00116         dist_dir_i = sys.argv.index("--dist-dir")
00117     except ValueError:
00118         dist_dir_i = None
00119     if dist_dir_i is not None:
00120         dist_dir = sys.argv[dist_dir_i+1]
00121         if "egg-dist-tmp" in dist_dir:
00122             is_automated = True
00123     # pip -- calls from python directly with "-c"
00124     if sys.argv in [["-c", "develop", "--no-deps"],
00125                     ["--no-deps", "-c", "develop"],
00126                     ["-c", "egg_info"]]:
00127         is_automated = True
00128     if is_automated:
00129         global _CHECKED
00130         if _CHECKED is None: _CHECKED = True
00131         install_requires.append("numpy >= 1.5.1")
00132     return install_requires

Here is the call graph for this function:

def setup.get_yes_or_no (   question,
  default 
)

Definition at line 38 of file setup.py.

00038 
00039 def get_yes_or_no(question, default):
00040     if default:
00041         option_str = "(Y/n)"
00042         default_str = 'y'
00043     else:
00044         option_str = "(y/N)"
00045         default_str = 'n'
00046 
00047     while True:
00048         print ("%s %s:" % (question, option_str))
00049         if sys.version_info[0] == 3:
00050             response = input().lower()
00051         else:
00052             response = raw_input().lower()
00053         if not response:
00054             response = default_str
00055         if response[0] in ['y', 'n']:
00056             break
00057         print ("Please answer y or n.")
00058     return response[0] == 'y'
00059 
# Make sure I have the right Python version.

Here is the caller graph for this function:

Definition at line 251 of file setup.py.

00251 
00252 def is_Numpy_installed():
00253     if is_pypy():
00254         return False
00255     return bool(can_import("numpy"))
00256 
00257 # --- set up the packages we are going to install
# standard biopython packages

Here is the call graph for this function:

Here is the caller graph for this function:

def setup.is_pypy ( )

Definition at line 28 of file setup.py.

00028 
00029 def is_pypy():
00030     import platform
00031     try:
00032         if platform.python_implementation()=='PyPy':
00033             return True
00034     except AttributeError:
00035         #New in Python 2.6, not in Jython yet either
00036         pass
00037     return False

Here is the caller graph for this function:


Variable Documentation

string setup.__version__ = "Undefined"

Definition at line 398 of file setup.py.

Definition at line 94 of file setup.py.

Definition at line 84 of file setup.py.

list setup.EXTENSIONS = []

Definition at line 336 of file setup.py.

Definition at line 380 of file setup.py.

tuple setup.numpy_include_dir = numpy.get_include()

Definition at line 375 of file setup.py.

Initial value:
00001 [
00002     'Bio.Affy',
00003     'Bio.Cluster',
00004     'Bio.KDTree',
00005 ]

Definition at line 328 of file setup.py.

tuple setup.old_path = os.getcwd()

Definition at line 407 of file setup.py.

Definition at line 258 of file setup.py.

string setup.python3_source = "build/py%i.%i"

Definition at line 67 of file setup.py.

dictionary setup.setup_args
Initial value:
00001 {
00002     "name" : 'biopython',
00003     "version" : __version__,
00004     "author" : 'The Biopython Consortium',
00005     "author_email" : 'biopython@biopython.org',
00006     "url" : 'http://www.biopython.org/',
00007     "description" : 'Freely available tools for computational molecular biology.',
00008     "download_url" : 'http://biopython.org/DIST/',
00009     "cmdclass" : {
00010         "install" : install_biopython,
00011         "build_py" : build_py_biopython,
00012         "build_ext" : build_ext_biopython,
00013         "test" : test_biopython,
00014         },
00015     "packages" : PACKAGES,
00016     "ext_modules" : EXTENSIONS,
00017     "package_data" : {
00018         'Bio.Entrez': ['DTDs/*.dtd', 'DTDs/*.ent', 'DTDs/*.mod'],
00019         'Bio.PopGen': ['SimCoal/data/*.par'],
00020          },
00021    }

Definition at line 415 of file setup.py.

Definition at line 409 of file setup.py.