-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
274 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include src *.cpp *.h *.inl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
nose | ||
pyflakes | ||
pep8 | ||
nose=1.3.7 | ||
pyflakes=0.9.2 | ||
pep8=1.5.6 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,131 @@ | |
# python setup.py install | ||
# | ||
|
||
from distutils.core import setup, Extension | ||
from distutils import log | ||
from distutils.core import Command | ||
from distutils.core import Extension | ||
from distutils.core import setup | ||
from distutils.command.build import build as _build | ||
from distutils.command.build_clib import build_clib as _build_clib | ||
from distutils.dep_util import newer_group | ||
from distutils.sysconfig import customize_compiler | ||
import os | ||
|
||
import argweaver | ||
|
||
|
||
VERSION = argweaver.PROGRAM_VERSION_TEXT | ||
|
||
scripts = [os.path.join('bin', x) for x in os.listdir('bin')] | ||
|
||
def get_files(path, ext=''): | ||
""" | ||
Get all files in a directory with a extension. | ||
""" | ||
files = [] | ||
for filename in os.listdir(path): | ||
if filename.endswith(ext): | ||
files.append(os.path.join(path, filename)) | ||
return files | ||
|
||
|
||
scripts = get_files('bin') | ||
lib_src = get_files('src/argweaver', '.cpp') | ||
|
||
|
||
# Default to a C++ compiler, if possible. | ||
if os.system('which g++') == 0: | ||
os.environ.setdefault('CC', 'g++') | ||
os.environ.setdefault('CXX', 'g++') | ||
|
||
|
||
class build(_build): | ||
""" | ||
Add more subcommands to the build command. | ||
""" | ||
sub_commands = _build.sub_commands + [('build_prog', lambda cmd: True)] | ||
|
||
|
||
class build_prog(_build_clib): | ||
""" | ||
Build subcommand for compiling programs. | ||
This is implemented as subclass of build_clib since compiling a | ||
C/C++ program is very similar to compiling C/C++ library. | ||
""" | ||
|
||
description = 'build compiled programs' | ||
|
||
# Config. Ideally, we could add this to setup(). | ||
progs = [ | ||
( | ||
'arg-sample', | ||
{ | ||
'sources': lib_src + ['src/arg-sample.cpp'], | ||
} | ||
), | ||
( | ||
'arg-summarize', | ||
{ | ||
'sources': lib_src + ['src/arg-summarize.cpp'], | ||
} | ||
), | ||
( | ||
'smc2bed', | ||
{ | ||
'sources': lib_src + ['src/smc2bed.cpp'], | ||
} | ||
), | ||
] | ||
|
||
def initialize_options(self): | ||
# Call super class. | ||
_build_clib.initialize_options(self) | ||
|
||
# Directory for built binaries. | ||
self.build_bin = None | ||
|
||
def finalize_options(self): | ||
# Call super class. | ||
_build_clib.finalize_options(self) | ||
|
||
self.set_undefined_options('build', ('build_scripts', 'build_bin')) | ||
|
||
self.libraries = self.progs | ||
if self.libraries: | ||
self.check_library_list(self.libraries) | ||
|
||
def build_libraries(self, libraries): | ||
if not os.path.exists(self.build_bin): | ||
os.makedirs(self.build_bin) | ||
|
||
for (prog_name, build_info) in libraries: | ||
sources = build_info.get('sources') | ||
if sources is None or not isinstance(sources, (list, tuple)): | ||
raise DistutilsSetupError, \ | ||
("in 'libraries' option ('%s'), " + | ||
"'sources' must be present and must be " + | ||
"a list of source filenames") % prog_name | ||
sources = list(sources) | ||
|
||
# Skip build, if program already built. | ||
prog_path = os.path.join(self.build_bin, prog_name) | ||
if not (self.force or newer_group(sources, prog_path, 'newer')): | ||
log.debug("skipping '%s' program (up-to-date)", prog_name) | ||
return | ||
|
||
log.info("building '%s' program", prog_name) | ||
|
||
macros = build_info.get('macros') | ||
include_dirs = build_info.get('include_dirs') | ||
objects = self.compiler.compile(sources, | ||
output_dir=self.build_temp, | ||
macros=macros, | ||
include_dirs=include_dirs, | ||
debug=self.debug) | ||
self.compiler.link_executable(objects, prog_name, | ||
output_dir=self.build_bin, | ||
debug=self.debug) | ||
|
||
|
||
setup( | ||
name='argweaver', | ||
|
@@ -22,7 +140,20 @@ | |
""", | ||
author='Matt Rasmussen', | ||
author_email='[email protected]', | ||
|
||
packages=['argweaver', 'argweaver.deps.rasmus', 'argweaver.deps.compbio'], | ||
cmdclass={ | ||
'build': build, | ||
'build_prog': build_prog, | ||
}, | ||
packages=[ | ||
'argweaver', | ||
'argweaver.deps.rasmus', | ||
'argweaver.deps.compbio', | ||
], | ||
scripts=scripts, | ||
ext_modules=[ | ||
Extension( | ||
'libargweaver', | ||
lib_src, | ||
) | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.