-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
executable file
·80 lines (68 loc) · 2.09 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
#-*- coding: utf-8 -*-
import os
import sys
import subprocess
import re
from setuptools import setup
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.install import install as _install
VERSION_PY = """
# This file is originally generated from Git information by running 'setup.py
# version'. Distribution tarballs contain a pre-generated copy of this file.
__version__ = '%s'
"""
def update_version_py():
if not os.path.isdir(".git"):
print "This does not appear to be a Git repository."
return
try:
p = subprocess.Popen(["git", "describe",
"--tags", "--always"],
stdout=subprocess.PIPE)
except EnvironmentError:
print "unable to run git, leaving hicbrowser/_version.py alone"
return
stdout = p.communicate()[0]
if p.returncode != 0:
print "unable to run git, leaving hicbrowser/_version.py alone"
return
ver = stdout.strip()
f = open("hicbrowser/_version.py", "w")
f.write(VERSION_PY % ver)
f.close()
print "set hicbrowser/_version.py to '%s'" % ver
def get_version():
try:
f = open("hicbrowser/_version.py")
except EnvironmentError:
return None
for line in f.readlines():
mo = re.match("__version__ = '([^']+)'", line)
if mo:
ver = mo.group(1)
return ver
return None
class sdist(_sdist):
def run(self):
update_version_py()
self.distribution.metadata.version = get_version()
return _sdist.run(self)
setup(
name='HiCBrowser',
version=get_version(),
author='Fidel Ramirez, José Villaveces, Vivek Bhardwaj',
author_email='[email protected]',
packages=['hicbrowser'],
scripts=['bin/runBrowser'],
include_package_data=True,
zip_safe=False,
license='LICENSE',
description='Simple web browser to visualize Hi-C and other genomic data.',
long_description=open('README.md').read(),
install_requires=[
"flask",
"hicexplorer",
"bx-python"
],
cmdclass={'sdist': sdist}
)