1 from distutils
.core
import setup
, Extension
2 from distutils
.command
.build_py
import build_py
as _build_py
8 class ExtBuilder(_build_py
):
9 """Enhanced 'build_py' command that includes data files with packages
11 The data files are specified via a 'package_data' argument to 'setup()'.
12 See 'setuptools.dist.Distribution' for more details.
14 Also, this version of the 'build_py' command allows you to specify both
15 'py_modules' and 'packages' in the same setup operation.
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()
25 """Build modules, packages, and copy data files to build directory"""
27 print """calling run...."""
29 if not self
.py_modules
and not self
.packages
:
37 self
.build_package_data()
39 # Only compile actual .py files, using our base class' idea of what our
41 self
.byte_compile(_build_py
.get_outputs(self
,include_bytecode
=0))
47 print """QPalma relies on two C++ extension modules:
53 print "Trying to compile ParaParser..."
55 currentStep
= 'cd ParaParser && make'
56 obj
= subprocess
.Popen(currentStep
,shell
=True,stdout
=subprocess
.PIPE
,stderr
=subprocess
.PIPE
)
57 out
,err
= obj
.communicate()
66 print "Trying to compile DynProg..."
68 currentStep
= 'cd DynProg && make'
69 obj
= subprocess
.Popen(currentStep
,shell
=True,stdout
=subprocess
.PIPE
,stderr
=subprocess
.PIPE
)
70 out
,err
= obj
.communicate()
77 # def get_data_files(self):
79 # """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
83 # for package in self.packages:
84 # # Locate package source directory
85 # src_dir = self.get_package_dir(package)
87 # # Compute package build directory
88 # build_dir = os.path.join(*([self.build_lib]+package.split('.')))
90 # # Length of path to strip from found files
91 # plen = len(src_dir)+1
93 # # Strip directory from globbed filenames
95 # file[plen:] for file in self.find_data_files(package, src_dir)
98 # data.append( (package, src_dir, build_dir, filenames) )
103 # def find_data_files(self, package, src_dir):
105 # """Return filenames for package's data files in 'src_dir'"""
107 # globs = self.package_data.get('',[])+self.package_data.get(package,[])
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))))
118 # def build_package_data(self):
120 # """Copy data files into build directory"""
124 # for package, src_dir, build_dir, filenames in self.data_files:
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)
132 # def get_outputs(self, include_bytecode=1):
134 # """Return complete list of files copied to the build directory
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.)
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
151 description
= 'A package for optimal alignment of short reads',
153 long_description
= '''
156 author
= 'Fabio De Bona, Gunnar Raetsch',
157 author_email
= 'fabio@tuebingen.mpg.de',
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
}