+ restructured test cases
[qpalma.git] / setup.py
1 from distutils.core import setup, Extension
2 from distutils.command.build_py import build_py as _build_py
3
4 import subprocess
5 import os
6
7
8 class ExtBuilder(_build_py):
9 """Enhanced 'build_py' command that includes data files with packages
10
11 The data files are specified via a 'package_data' argument to 'setup()'.
12 See 'setuptools.dist.Distribution' for more details.
13
14 Also, this version of the 'build_py' command allows you to specify both
15 'py_modules' and 'packages' in the same setup operation.
16 """
17
18 def finalize_options(self):
19 _build_py.finalize_options(self)
20 self.package_data = self.distribution.package_data
21 self.data_files = self.get_data_files()
22
23
24 def run(self):
25 """Build modules, packages, and copy data files to build directory"""
26
27 print """calling run...."""
28
29 if not self.py_modules and not self.packages:
30 return
31
32 if self.py_modules:
33 self.build_modules()
34
35 if self.packages:
36 self.build_packages()
37 self.build_package_data()
38
39 # Only compile actual .py files, using our base class' idea of what our
40 # output files are.
41 self.byte_compile(_build_py.get_outputs(self,include_bytecode=0))
42
43 cwd = os.getcwd()
44
45 print '-'*60
46 print
47 print """QPalma relies on two C++ extension modules:
48 \t- ParaParser, and
49 \t- DynProg
50 """
51 print
52
53 print "Trying to compile ParaParser..."
54
55 currentStep = 'cd ParaParser && make'
56 obj = subprocess.Popen(currentStep,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
57 out,err = obj.communicate()
58
59 if err != '':
60 print out
61 print err
62 print '-'*60
63
64 os.chdir(cwd)
65
66 print "Trying to compile DynProg..."
67
68 currentStep = 'cd DynProg && make'
69 obj = subprocess.Popen(currentStep,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
70 out,err = obj.communicate()
71
72 if err != '':
73 print out
74 print err
75 print '-'*60
76
77 # def get_data_files(self):
78 #
79 # """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
80 #
81 # data = []
82 #
83 # for package in self.packages:
84 # # Locate package source directory
85 # src_dir = self.get_package_dir(package)
86 #
87 # # Compute package build directory
88 # build_dir = os.path.join(*([self.build_lib]+package.split('.')))
89 #
90 # # Length of path to strip from found files
91 # plen = len(src_dir)+1
92 #
93 # # Strip directory from globbed filenames
94 # filenames = [
95 # file[plen:] for file in self.find_data_files(package, src_dir)
96 # ]
97 #
98 # data.append( (package, src_dir, build_dir, filenames) )
99 #
100 # return data
101 #
102 #
103 # def find_data_files(self, package, src_dir):
104 #
105 # """Return filenames for package's data files in 'src_dir'"""
106 #
107 # globs = self.package_data.get('',[])+self.package_data.get(package,[])
108 # files = []
109 #
110 # for pattern in globs:
111 # # Each pattern has to be converted to a platform-specific path
112 # files.extend(glob(os.path.join(src_dir, convert_path(pattern))))
113 #
114 # return files
115 #
116 #
117 #
118 # def build_package_data(self):
119 #
120 # """Copy data files into build directory"""
121 #
122 # lastdir = None
123 #
124 # for package, src_dir, build_dir, filenames in self.data_files:
125 #
126 # for filename in filenames:
127 # target = os.path.join(build_dir,filename)
128 # self.mkpath(os.path.dirname(target))
129 # self.copy_file(os.path.join(src_dir,filename), target)
130 #
131 #
132 # def get_outputs(self, include_bytecode=1):
133 #
134 # """Return complete list of files copied to the build directory
135 #
136 # This includes both '.py' files and data files, as well as '.pyc' and
137 # '.pyo' files if 'include_bytecode' is true. (This method is needed for
138 # the 'install_lib' command to do its job properly, and to generate a
139 # correct installation manifest.)
140 # """
141 #
142 # return _build_py.get_outputs(include_bytecode) + [
143 # os.path.join(build_dir,filename)
144 # for package,src_dir,build_dir,filenames in self.data_files
145 # for filename in filenames
146 # ]
147 #
148
149 setup (
150 name = 'QPalma',
151 description = 'A package for optimal alignment of short reads',
152 version = '0.9',
153 long_description = '''
154 A
155 ''',
156 author = 'Fabio De Bona, Gunnar Raetsch',
157 author_email = 'fabio@tuebingen.mpg.de',
158 url = 'http://',
159 license = 'GNU GPL version 3',
160 #ext_package = "qpalma",
161 #ext_modules = extmods,
162 package_dir = {"qpalma": "qpalma"},
163 packages = ["qpalma","scripts"],
164 cmdclass={'build_py': ExtBuilder}
165 )