-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·86 lines (70 loc) · 2.81 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
#!/usr/bin/env python3
import os
import re
import shutil
import subprocess
import sys
from setuptools import Command, setup
class UploadCommand(Command):
"""Support setup.py upload."""
description = "Build and publish the package."
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
self.status("Cleaning previous builds...")
for p in ("build", "dist", *(p for p in os.listdir(setup_dir) if p.endswith(".egg-info"))):
shutil.rmtree(os.path.join(setup_dir, p), True)
except OSError:
pass
self.status("Building Source and Wheel (universal) distribution...")
subprocess.run([sys.executable, "-m", "build"], check=True)
self.status("Uploading the package to PyPI via Twine...")
dist_dir = os.path.join(setup_dir, "dist")
subprocess.run(["twine", "upload", *(os.path.join(dist_dir, p) for p in os.listdir(dist_dir))], check=True)
self.status("Pushing git tags...")
subprocess.run(["git", "tag", f"v{version}"], check=True)
subprocess.run(["git", "push", "--tags"], check=True)
setup_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(setup_dir, "README.md"), "r") as f:
long_description = f.read()
with open(os.path.join(setup_dir, "csync", "__init__.py"), "r") as f:
version = re.search(r"__version__\s*=\s*['\"](.+)['\"]", f.read()).group(1)
setup(
author="Halit Şimşek",
author_email="mail.simsekhalit@gmail.com",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: System :: Archiving :: Backup",
],
cmdclass={
"upload": UploadCommand,
},
description="A concurrent sync tool which works with multiple sources and targets.",
install_requires=["psutil"],
keywords=["archive", "backup", "buffer", "concurrent", "csync", "rsync", "sync", "synchronization"],
license="MIT",
long_description=long_description,
long_description_content_type="text/markdown",
name="concurrent-sync",
packages=["csync"],
python_requires=">=3.8",
url="https://www.github.com/simsekhalit/concurrent-sync",
version=version,
)