-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathsetup.py
107 lines (95 loc) · 4.02 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
101
102
103
104
105
106
107
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
import veles
from veles import __root__, __project__, __version__, __license__,\
__authors__, __contact__, __versioninfo__, __date__, formatdate
MANIFEST = os.path.join(__root__, "MANIFEST.in")
def write_exclusions(gitattrfile):
root = os.path.relpath(os.path.dirname(gitattrfile), __root__)
with open(gitattrfile, "r") as fin:
lines = fin.readlines()
exclusions = []
for item in (line[:-len('export-ignore\n')].strip() for line in lines
if line.endswith('export-ignore\n')):
path = os.path.join(root, item)
if path.startswith("./"):
path = path[2:]
if os.path.isdir(path):
exclusions.append("prune %s\n" % path)
elif os.path.exists(path):
exclusions.append("exclude %s\n" % path)
else:
parent = os.path.dirname(path)
if parent:
mask = os.path.basename(item)
exclusions.append("recursive-exclude %s %s\n" % (parent, mask))
else:
exclusions.append("exclude %s\n" % path)
with open(MANIFEST, "a") as fout:
fout.writelines(exclusions)
def make_release(patch_init=True, patch_changelog=True):
incver = __versioninfo__[:-1] + (__versioninfo__[-1] + 1,)
strver = [str(v) for v in incver]
if patch_init:
with open(veles.__file__, "r+") as init:
patched = init.read().replace(
"__versioninfo__ = %s" % ", ".join(map(str, __versioninfo__)),
"__versioninfo__ = %s" % ", ".join(strver))
init.seek(0, os.SEEK_SET)
init.write(patched)
chlog_head = """veles (%(ver)s-0) trusty utopic; urgency=medium
* %(ver)s release, see https://github.com/samsung/veles/releases/tag/v%(ver)s
-- Markovtsev Vadim <[email protected]> %(date)s
""" % {"ver": ".".join(strver), "date": formatdate(__date__, True)}
if patch_changelog:
with open(os.path.join(__root__, "debian", "changelog"), "r+") as fch:
changelog = fch.read()
changelog = chlog_head + changelog
fch.seek(0, os.SEEK_SET)
fch.write(changelog)
return incver
if __name__ == "__main__":
if not os.path.exists(MANIFEST):
print("processing .gitattributes")
if os.path.exists(MANIFEST):
os.remove(MANIFEST)
for root, dirs, files in os.walk(__root__):
if ".gitattributes" in files:
write_exclusions(os.path.join(root, ".gitattributes"))
with open(MANIFEST, "a") as fout:
fout.write("prune deploy\n")
fout.write("exclude MANIFEST.in\n")
setup(
setup_requires=["setuptools_git", ],
name="Veles",
description=__project__,
version=__version__,
license=__license__,
author=__authors__,
author_email=__contact__,
url="http://confluence.rnd.samsung.ru/display/VEL/Veles",
download_url="http://alserver.rnd.samsung.ru/gerrit/Veles",
packages=find_packages(),
include_package_data=True,
entry_points={
'console_scripts': [
'veles=veles.__main__:__run__',
'compare_snapshots=veles.scripts.compare_snapshots:main',
'bboxer=veles.scripts.bboxer:main',
'generate_veles_frontend=veles.scripts.generate_frontend:main',
'veles_graphics_client=veles.graphics_client:main']
},
keywords=["Samsung", "Veles", "Znicz"],
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: " + __license__,
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering :: Information Analysis"
]
)