This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
101 lines (84 loc) · 2.75 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
99
100
import os
import glob
from ConfigParser import ConfigParser
from distutils.cmd import Command
from distutils.errors import DistutilsExecError
from distutils.command.sdist import sdist as _sdist
from setuptools import setup, find_packages
p = ConfigParser()
p.read("metainf.cfg")
PACKAGE = p.get("main", "package")
DESCRIPTION = p.get("main", "description")
VERSION = __import__(PACKAGE).__version__
class epydoc(Command):
description = "Builds the documentation."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
if not os.path.exists("epydoc.cfg"):
return
self.mkpath("doc/html")
stat = os.system("epydoc --config epydoc.cfg %s/*.py" % (PACKAGE))
if not stat == 0:
raise DistutilsExecError("failed to run epydoc")
class nosetests(Command):
description = "Runs the tests."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from nose.core import TestProgram
TestProgram(argv=[PACKAGE]).runTests()
class sdist(_sdist):
def run(self):
self.run_command("epydoc")
_sdist.run(self)
def datafiles():
"""Returns a list of (path, [files]) to install.
"""
def _datafiles():
root = os.path.join("share", "doc", PACKAGE + "-" + VERSION)
yield (root, [x for x in ("ChangeLog", "LICENSE", "README") if os.path.exists(x)])
for dn, pattern in (("doc/html", "*"), ("examples", "*.py")):
files = glob.glob(os.path.join(dn, pattern))
if files:
yield (os.path.join(root, dn), files)
return list(_datafiles())
def scripts():
"""Returns a list of script files to install.
"""
return glob.glob(os.path.join("scripts", "*"))
setup(
name = PACKAGE,
version = VERSION,
description = DESCRIPTION,
author = "Brian Zimmer",
author_email = "[email protected]",
url = "http://code.google.com/p/%s" % (PACKAGE),
download_url = "http://pypi.python.org/pypi/%s/%s" % (PACKAGE, VERSION),
packages = find_packages(),
scripts = scripts(),
data_files = datafiles(),
platforms = ['any'],
license = "MIT License",
classifiers = [
'Intended Audience :: Developers',
'Development Status :: 3 - Alpha',
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
],
cmdclass = {"epydoc":epydoc, "sdist":sdist, "nosetests":nosetests},
entry_points="""
[console_scripts]
mgtool = pysmug.smugfind:main
mgup = pysmug.smugup:main
""",
zip_safe = True,
)