-
Notifications
You must be signed in to change notification settings - Fork 28
/
setup.py
81 lines (65 loc) · 2.86 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#(c) 2016 by Authors
#This file is a part of Ragout program.
#Released under the BSD license (see LICENSE file)
from __future__ import print_function
import os
import sys
import subprocess
import shutil
try:
import setuptools
except ImportError:
sys.exit("setuptools package not found. "
"Please use 'pip install setuptools' first")
from setuptools import setup
from setuptools.command.install import install as SetuptoolsInstall
from distutils.command.build import build as DistutilsBuild
from distutils.spawn import find_executable
# Make sure we're running from the setup.py directory.
script_dir = os.path.dirname(os.path.realpath(__file__))
if script_dir != os.getcwd():
os.chdir(script_dir)
from ragout.__version__ import __version__
class MakeBuild(DistutilsBuild):
def run(self):
DistutilsBuild.run(self)
if not find_executable("make"):
sys.exit("ERROR: 'make' command is unavailable")
try:
subprocess.check_call(["make"])
except subprocess.CalledProcessError as e:
sys.exit("Compilation error: ", e)
class MakeInstall(SetuptoolsInstall):
def run(self):
SetuptoolsInstall.run(self)
print('Installing C++ binaries')
if os.path.isdir(self.install_lib) and not os.access(self.install_lib, os.W_OK):
sys.exit('Error: no write permission for ' + self.install_lib + ' ' +
'Perhaps you need to use sudo?')
if os.path.isdir(self.install_scripts) and not os.access(self.install_scripts, os.W_OK):
sys.exit('Error: no write permission for ' + self.install_scripts + ' ' +
'Perhaps you need to use sudo?')
build_dir = os.path.join(script_dir, "bin")
install_dir = self.install_scripts
bin_files = ['ragout-maf2synteny', 'ragout-overlap']
for file in bin_files:
if not os.path.isfile(os.path.join(build_dir, file)):
sys.exit('Error: binary not found: ' + file)
shutil.copy2(os.path.join(build_dir, file),
os.path.join(install_dir, file))
setup(name='ragout',
version=__version__,
description='Chromosome assembly using multiple references',
url='https://github.com/fenderglass/Ragout',
author='Mikhail Kolmogorov',
author_email = '[email protected]',
license='BSD-3-Clause',
packages=['ragout', 'ragout/assembly_graph', 'ragout/breakpoint_graph',
'ragout/maf2synteny', 'ragout/overlap', 'ragout/parsers',
'ragout/phylogeny', 'ragout/scaffolder', 'ragout/shared',
'ragout/synteny_backend', 'ragout/newick', 'ragout/tests'],
package_data={'ragout': ['tests/data/*']},
entry_points={'console_scripts': ['ragout = ragout.main:main']},
cmdclass={'build': MakeBuild,
'install' : MakeInstall}
)