source: CMIP6dreq/tags/01.beta.18/setup.py @ 474

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/tags/01.beta.18/setup.py@576
Revision 474, 2.8 KB checked in by mjuckes, 5 years ago (diff)

Updated setup for tag 01.beta.12

Line 
1import codecs
2import os, sys
3import re
4
5from setuptools import setup, find_packages
6
7####################################################################
8
9NAME = "dreqPy"
10PACKAGES = find_packages(exclude=["tests*"])
11META_PATH = os.path.join("dreqPy", "packageConfig.py")
12KEYWORDS = ["CMIP6"]
13CLASSIFIERS = [
14    "Development Status :: 4 - Beta",
15    "Intended Audience :: Developers",
16    "Natural Language :: English",
17    "License :: OSI Approved :: MIT License",
18    "Operating System :: OS Independent",
19    "Programming Language :: Python",
20    "Programming Language :: Python :: 2",
21    "Programming Language :: Python :: 2.7",
22    "Programming Language :: Python :: 3",
23    "Topic :: Software Development :: Libraries :: Python Modules",
24]
25INSTALL_REQUIRES = []
26
27###################################################################
28
29HERE = os.path.abspath(os.path.dirname(__file__))
30
31
32def read(*parts):
33    """
34    Build an absolute path from *parts* and and return the contents of the
35    resulting file.  Assume UTF-8 encoding.
36    """
37    with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
38        return f.read()
39
40
41META_FILE = read(META_PATH)
42
43def find_meta(meta):
44    """
45    Extract __*meta*__ from META_FILE.
46    """
47    import dreqPy.packageConfig as pcfg
48    if '__%s__' % meta in pcfg.__dict__:
49      return pcfg.__dict__[ '__%s__' % meta ]
50
51    raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
52
53def find_meta0(meta):
54    """
55    Extract __*meta*__ from META_FILE.
56    """
57    meta_match = re.search(
58        r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta),
59        META_FILE, re.M
60    )
61    if meta_match:
62        return meta_match.group(1)
63    raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
64
65class test(object):
66  def __init__(self):
67    for v in ['license','uri','version']:
68      print ( '%s: %s' % (v,find_meta(v) ) )
69      assert os.path.isfile( 'LICENSE' ), 'License file not found'
70      assert os.path.isfile( 'README.txt' ), 'README file not found'
71
72if __name__ == "__main__":
73   if len(sys.argv) > 1 and sys.argv[1] == '-t':
74      t = test()
75   else:
76      setup(
77        name=NAME,
78        description=find_meta("description"),
79        license=find_meta("license"),
80        url=find_meta("uri"),
81        version=find_meta("version"),
82        author=find_meta("author"),
83        author_email=find_meta("email"),
84        maintainer=find_meta("author"),
85        maintainer_email=find_meta("email"),
86        keywords=KEYWORDS,
87        include_package_data=True,
88        long_description=read("README.txt"),
89        packages=PACKAGES,
90        zip_safe=False,
91        classifiers=CLASSIFIERS,
92        install_requires=INSTALL_REQUIRES,
93        data_files = [("", ["LICENSE"])],
94        entry_points= {
95        'console_scripts': ['drq = dreqPy.dreqCmdl:main_entry'],
96        },
97    )
Note: See TracBrowser for help on using the repository browser.