1
|
|
|
from setuptools import setup, Command, find_packages |
2
|
|
|
|
3
|
|
|
import glob |
4
|
|
|
import os.path |
5
|
|
|
import os |
6
|
|
|
import subprocess |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
PACKAGE = "m9dicts" |
10
|
|
|
VERSION = "0.4.0" # see m9dicts.__version__ |
11
|
|
|
|
12
|
|
|
# For daily snapshot versioning mode: |
13
|
|
|
if os.environ.get("_SNAPSHOT_BUILD", None) is not None: |
14
|
|
|
import datetime |
15
|
|
|
VERSION = VERSION + datetime.datetime.now().strftime(".%Y%m%d") |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
_LONG_DESC = """ |
19
|
|
|
python-m9dicts (merge-able dicts) is a `MIT licensed |
20
|
|
|
<http://opensource.org/licenses/MIT>`_ python library provides some dict-like |
21
|
|
|
objects support recursive merge operations according to each merge strategies. |
22
|
|
|
|
23
|
|
|
- Home: https://github.com/ssato/python-m9dicts |
24
|
|
|
- PyPI: https://pypi.python.org/pypi/m9dicts |
25
|
|
|
""" |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
class SrpmCommand(Command): |
29
|
|
|
|
30
|
|
|
user_options = [] |
31
|
|
|
build_stage = "s" |
32
|
|
|
|
33
|
|
|
curdir = os.path.abspath(os.curdir) |
34
|
|
|
rpmspec = os.path.join(curdir, "pkg/package.spec") |
35
|
|
|
|
36
|
|
|
def initialize_options(self): |
37
|
|
|
pass |
38
|
|
|
|
39
|
|
|
def finalize_options(self): |
40
|
|
|
pass |
41
|
|
|
|
42
|
|
|
def run(self): |
43
|
|
|
self.pre_sdist() |
44
|
|
|
self.run_command('sdist') |
45
|
|
|
self.build_rpm() |
46
|
|
|
|
47
|
|
|
def pre_sdist(self): |
48
|
|
|
c = open(self.rpmspec + ".in").read() |
49
|
|
|
open(self.rpmspec, "w").write(c.replace("@VERSION@", VERSION)) |
50
|
|
|
|
51
|
|
|
def build_rpm(self): |
52
|
|
|
rpmbuild = os.path.join(self.curdir, "pkg/rpmbuild-wrapper.sh") |
53
|
|
|
workdir = os.path.join(self.curdir, "dist") |
54
|
|
|
|
55
|
|
|
cmd_s = "%s -w %s -s %s %s" % (rpmbuild, workdir, self.build_stage, |
56
|
|
|
self.rpmspec) |
57
|
|
|
subprocess.check_call(cmd_s, shell=True) |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
class RpmCommand(SrpmCommand): |
61
|
|
|
|
62
|
|
|
build_stage = "b" |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
_CLASSIFIERS = ["Development Status :: 4 - Beta", |
66
|
|
|
"Intended Audience :: Developers", |
67
|
|
|
"Programming Language :: Python", |
68
|
|
|
"Programming Language :: Python :: 2", |
69
|
|
|
"Programming Language :: Python :: 3", |
70
|
|
|
"Programming Language :: Python :: 2.6", |
71
|
|
|
"Programming Language :: Python :: 2.7", |
72
|
|
|
"Programming Language :: Python :: 3.3", |
73
|
|
|
"Programming Language :: Python :: 3.4", |
74
|
|
|
"Programming Language :: Python :: 3.5", |
75
|
|
|
"Environment :: Console", |
76
|
|
|
"Operating System :: OS Independent", |
77
|
|
|
"Topic :: Software Development :: Libraries", |
78
|
|
|
"Topic :: Software Development :: Libraries :: Python Modules", |
79
|
|
|
"Topic :: Utilities", |
80
|
|
|
"License :: OSI Approved :: MIT License"] |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
setup(name=PACKAGE, |
84
|
|
|
version=VERSION, |
85
|
|
|
description="dict-like objects support recursive merge operations", |
86
|
|
|
long_description=_LONG_DESC, |
87
|
|
|
author="Satoru SATOH", |
88
|
|
|
author_email="[email protected]", |
89
|
|
|
license="MIT", |
90
|
|
|
url="https://github.com/ssato/python-m9dicts", |
91
|
|
|
classifiers=_CLASSIFIERS, |
92
|
|
|
packages=find_packages(), |
93
|
|
|
include_package_data=True, |
94
|
|
|
cmdclass={ |
95
|
|
|
"srpm": SrpmCommand, |
96
|
|
|
"rpm": RpmCommand, |
97
|
|
|
}, |
98
|
|
|
) |
99
|
|
|
|
100
|
|
|
# vim:sw=4:ts=4:et: |
101
|
|
|
|