-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
98 lines (84 loc) · 2.9 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
from setuptools.command.build_py import build_py
from setuptools.command.install import install
from setuptools.command.sdist import sdist
from setuptools import setup, find_packages
# Utility function to read the README file. Also support json content
def read_file(fname, content_type=None):
dir_path = os.path.dirname(os.path.realpath(__file__))
p = os.path.join(dir_path, fname)
with open(p) as f:
if content_type in ("json",):
data = json.load(f)
else:
data = f.read()
return data
def read_version():
d = read_file("package.json", "json")
return d["version"]
VERSION = read_version()
DESCRIPTION = "OMERO webtagging autotag app"
AUTHOR = "D.P.W. Russell"
MAINTAINER = "Tom Boissonnet"
LICENSE = "AGPL-3.0"
HOMEPAGE = "https://github.com/German-BioImaging/omero-autotag"
REQUIREMENTS = ["omero-web>=5.6.0"]
def require_npm(command, strict=False):
"""
Decorator to run NPM prerequisites
"""
class WrappedCommand(command):
def run(self):
if strict or not os.path.isdir(
"omero_autotag/static/omero_autotag/js"
):
self.spawn(["npm", "install"])
self.spawn(["npm", "run", "build"])
command.run(self)
return WrappedCommand
setup(
name="omero-autotag",
packages=find_packages(exclude=["ez_setup"]),
version=VERSION,
description=DESCRIPTION,
long_description=read_file("README.rst"),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: JavaScript',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development :: Libraries :: '
'Application Frameworks',
'Topic :: Text Processing :: Markup :: HTML'
],
author=AUTHOR,
author_email="[email protected]",
maintainer=MAINTAINER,
maintainer_email="[email protected]",
license=LICENSE,
url=HOMEPAGE,
download_url="%s/archive/v%s.tar.gz" % (HOMEPAGE, VERSION),
keywords=["OMERO.web", "webtagging", "autotag"],
install_requires=REQUIREMENTS,
python_requires=">=3",
include_package_data=True,
zip_safe=False,
cmdclass={
"build_py": require_npm(build_py),
"install": require_npm(install),
"sdist": require_npm(sdist, True),
},
)