forked from mikolmogorov/Flye
-
Notifications
You must be signed in to change notification settings - Fork 0
/
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-2019 by Authors
#This file is a part of the Flye package
#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 flye.__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 = ['flye-assemble', 'flye-polish', 'flye-contigger',
'flye-repeat', 'flye-minimap2']
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='flye',
version=__version__,
description='De novo assembler for single molecule sequencing reads using repeat graphs',
url='https://github.com/fenderglass/Flye',
author='Mikhail Kolmogorov',
author_email = '[email protected]',
license='BSD-3-Clause',
packages=['flye', 'flye/assembly', 'flye/config', 'flye/polishing',
'flye/utils', 'flye/repeat_graph', 'flye/short_plasmids',
'flye/trestle', 'flye/tests'],
package_data={'flye': ['config/bin_cfg/*', 'tests/data/*']},
entry_points={'console_scripts': ['flye = flye.main:main']},
cmdclass={'build': MakeBuild,
'install' : MakeInstall}
)