-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
95 lines (77 loc) · 2.8 KB
/
Copy pathsetup.py
File metadata and controls
95 lines (77 loc) · 2.8 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
# basically this unzips the db files before installing
from setuptools.command.build_py import build_py
from setuptools import Command
# https://stackoverflow.com/questions/20288711/post-install-script-with-python-setuptools
import os
import subprocess
PATH = os.path.dirname(__file__)
DB_PATH = os.path.join(PATH, 'cellmesh', 'data')
DB_FILES = ['cellmesh.db', 'anatomy_mesh.db']
GZ_DB_FILES = ['cellmesh.db.gz', 'anatomy_mesh.db.gz']
class DevelopWithGunzip(develop):
def run(self):
print('unzipping db files')
for f in GZ_DB_FILES:
subprocess.run('gunzip {0}'.format(os.path.join(DB_PATH, f)), shell=True)
develop.run(self)
class InstallWithGunzip(install):
def run(self):
print('unzipping db files (install)')
for f in GZ_DB_FILES:
subprocess.run('gunzip {0}'.format(os.path.join(DB_PATH, f)), shell=True)
install.run(self)
class BuildWithGunzip(build_py):
def run(self):
print('unzipping db files (build_py)')
for f in GZ_DB_FILES:
subprocess.run('gunzip {0}'.format(os.path.join(DB_PATH, f)), shell=True)
build_py.run(self)
class GunzipDBFiles(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for f in GZ_DB_FILES:
subprocess.run('gunzip {0}'.format(os.path.join(DB_PATH, f)), shell=True)
class GzipDBFiles(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for f in DB_FILES:
subprocess.run('gzip {0}'.format(os.path.join(DB_PATH, f)), shell=True)
setup(
name='cellmesh',
version='0.1.0',
author='Yue Zhang',
author_email='yjzhang@cs.washington.edu',
url='https://github.com/yjzhang/cellmesh',
license='MIT',
install_requires=['backports.functools_lru_cache', 'goatools'],
packages=find_packages("."),
cmdclass={
'build_py': BuildWithGunzip,
'develop': DevelopWithGunzip,
'install': InstallWithGunzip,
'unzip': GunzipDBFiles,
'zip': GzipDBFiles,
},
# this is for including the data dir in the package.
zip_safe=False,
package_data={'cellmesh': ['data/cellmesh.db', 'data/cellmesh.db.gz', 'data/anatomy_mesh.db', 'data/anatomy_mesh.db.gz', 'data/*.txt']},
include_package_data=True,
classifiers=[
'Development Status :: 3 - Alpha',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
],
)