-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
123 lines (103 loc) · 3.72 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# -*- coding: utf-8 -*-
# Copyright (C) 2021 The Project TONA Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from setuptools import setup, Command
from shutil import rmtree
import os
import sys
import re
class PublishCommand(Command):
user_options = [
('testpypi', 't', "Publish on https://test.pypi.org/")
]
def initialize_options(self):
self.testpypi = 0
def finalize_options(self):
pass
def run(self):
try:
print("Removing previous builds ...")
rmtree("./dist")
except OSError:
pass
print("Building Source and Wheel (universal) distribution…")
os.system("{0} setup.py sdist bdist_wheel --universal"
.format(sys.executable))
print("Uploading the package to PyPi via Twine…")
if self.testpypi:
os.system("twine upload --repository testpypi dist/*")
else:
os.system("twine upload dist/*")
long_description = ""
with open("README.md", encoding="utf-8") as f:
long_description = f.read()
requirements = []
with open("requirements.txt", encoding="utf-8") as f:
for line in f.readlines():
requirements.append(line.replace('\n', ''))
package_data = []
package_dir = {}
packages =[]
for data in os.walk("."):
dir = data[0]
if not re.search(".git|.pm|__pycache__|storage", dir):
if re.search("static|templates", dir):
package_data.append(dir+"/*")
else:
# TODO: Check is work replace on Windows
package = 'tona' if dir == '.' else 'tona' + dir[1:].replace('/','.')
package_dir.update({package: dir})
packages.append(package)
setup(
name="tona",
version="0.1.0",
url="https://github.com/sentilis/tona",
author="Jose Hbez",
author_email="[email protected]",
description="Lightweight tools for personal productivity",
long_description=long_description,
long_description_content_type='text/markdown',
packages=packages,
package_dir=package_dir,
package_data={'tona': package_data},
entry_points={
"console_scripts": ["tona=tona.main:main"]
},
install_requires=requirements,
license="GPLv3",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Utilities",
],
cmdclass={
"publish": PublishCommand
}
)