annotate setup.py @ 0:c55bdc2fb9fa

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