Mercurial > repos > davidmurphy > codonlogo
comparison setup.py @ 4:4d47ab2b7bcc
Uploaded
| author | davidmurphy | 
|---|---|
| date | Fri, 13 Jan 2012 07:18:19 -0500 | 
| parents | c55bdc2fb9fa | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 3:09d2dac9ef73 | 4:4d47ab2b7bcc | 
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import sys | |
| 4 | |
| 5 from distutils.core import setup | |
| 6 from distutils.core import Extension | |
| 7 from distutils.command.build import build | |
| 8 from distutils.command.install_data import install_data | |
| 9 | |
| 10 # Supress warning that distutils generates for the install_requires option | |
| 11 import warnings | |
| 12 warnings.simplefilter('ignore', UserWarning, lineno =236) | |
| 13 | |
| 14 # check dependancies | |
| 15 if not hasattr(sys, 'version_info') or sys.version_info < (2,3,0,'final'): | |
| 16 raise SystemExit, \ | |
| 17 "Dependancy error: CodonLogo requires Python 2.3 or later." | |
| 18 | |
| 19 | |
| 20 from weblogolib import __version__ | |
| 21 | |
| 22 def main() : | |
| 23 long_description = open("README.txt").read() | |
| 24 | |
| 25 | |
| 26 setup( | |
| 27 name = "codonlogo", | |
| 28 version = __version__, | |
| 29 description = "CodonLogo: WebLogo3 messed around with", | |
| 30 long_description = long_description, | |
| 31 maintainer = "David Murphy", | |
| 32 maintainer_email = "Murphy.David@gmail.com", | |
| 33 classifiers =[ | |
| 34 'Development Status :: Alpha', | |
| 35 'Intended Audience :: Science/Research', | |
| 36 'License :: OSI Approved :: BSD License', | |
| 37 'Topic :: Scientific/Engineering :: Bio-Informatics', | |
| 38 'Programming Language :: Python', | |
| 39 'Natural Language :: English', | |
| 40 'Operating System :: OS Independent', | |
| 41 'Topic :: Software Development :: Libraries', | |
| 42 'Topic :: Software Development :: Libraries :: Python Modules', | |
| 43 ], | |
| 44 | |
| 45 scripts = [ 'codonlogo', ], | |
| 46 packages = [ 'weblogolib',], | |
| 47 data_files = ['weblogolib/htdocs/*.*','weblogolib/template.eps'], | |
| 48 install_requires=['numpy', 'corebio'], | |
| 49 | |
| 50 cmdclass= {"install_data" : _install_data}, | |
| 51 ) | |
| 52 | |
| 53 | |
| 54 # Python 2.3 compatability | |
| 55 # Rework the install_data command to act like the package_data distutils | |
| 56 # command included with python 2.4. | |
| 57 # Adapted from biopython, which was adapted from mxtexttools | |
| 58 class _install_data(install_data): | |
| 59 def finalize_options(self): | |
| 60 if self.install_dir is None: | |
| 61 installobj = self.distribution.get_command_obj('install') | |
| 62 # Use install_lib rather than install_platlib because we are | |
| 63 # currently a pure python distribution (No c extensions.) | |
| 64 self.install_dir = installobj.install_lib | |
| 65 #print installobj.install_lib | |
| 66 install_data.finalize_options(self) | |
| 67 | |
| 68 def run (self): | |
| 69 import glob | |
| 70 import os | |
| 71 if not self.dry_run: | |
| 72 self.mkpath(self.install_dir) | |
| 73 data_files = self.get_inputs() | |
| 74 for entry in data_files: | |
| 75 if type(entry) is not type(""): | |
| 76 raise ValueError("data_files must be strings") | |
| 77 # Unix- to platform-convention conversion | |
| 78 entry = os.sep.join(entry.split("/")) | |
| 79 filenames = glob.glob(entry) | |
| 80 for filename in filenames: | |
| 81 dst = os.path.join(self.install_dir, filename) | |
| 82 dstdir = os.path.split(dst)[0] | |
| 83 if not self.dry_run: | |
| 84 self.mkpath(dstdir) | |
| 85 outfile = self.copy_file(filename, dst)[0] | |
| 86 else: | |
| 87 outfile = dst | |
| 88 self.outfiles.append(outfile) | |
| 89 | |
| 90 if __name__ == '__main__' : | |
| 91 main() | |
| 92 | |
| 93 | 
