Skip to content

Commit 790e006

Browse files
committed
Clean up setup.py (#234)
1 parent 1117551 commit 790e006

File tree

1 file changed

+8
-59
lines changed

1 file changed

+8
-59
lines changed

setup.py

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,17 @@
11
#!/usr/bin/env python
2-
import semver as package
3-
from glob import glob
4-
from os import remove
52
from os.path import dirname, join
63
from setuptools import setup
7-
from setuptools.command.test import test as TestCommand
8-
9-
try:
10-
from setuptools.command.clean import clean as CleanCommand
11-
except ImportError:
12-
from distutils.command.clean import clean as CleanCommand
13-
from shlex import split
14-
from shutil import rmtree
15-
16-
17-
class Tox(TestCommand):
18-
user_options = [("tox-args=", "a", "Arguments to pass to tox")]
19-
20-
def initialize_options(self):
21-
TestCommand.initialize_options(self)
22-
self.tox_args = None
23-
24-
def finalize_options(self):
25-
TestCommand.finalize_options(self)
26-
self.test_args = []
27-
self.test_suite = True
28-
29-
def run_tests(self):
30-
from tox import cmdline
314

32-
args = self.tox_args
33-
if args:
34-
args = split(self.tox_args)
35-
errno = cmdline(args=args)
36-
exit(errno)
37-
38-
39-
class Clean(CleanCommand):
40-
def run(self):
41-
CleanCommand.run(self)
42-
delete_in_root = ["build", ".cache", "dist", ".eggs", "*.egg-info", ".tox"]
43-
delete_everywhere = ["__pycache__", "*.pyc"]
44-
for candidate in delete_in_root:
45-
rmtree_glob(candidate)
46-
for visible_dir in glob("[A-Za-z0-9]*"):
47-
for candidate in delete_everywhere:
48-
rmtree_glob(join(visible_dir, candidate))
49-
rmtree_glob(join(visible_dir, "*", candidate))
50-
51-
52-
def rmtree_glob(file_glob):
53-
for fobj in glob(file_glob):
54-
try:
55-
rmtree(fobj)
56-
print("%s/ removed ..." % fobj)
57-
except OSError:
58-
try:
59-
remove(fobj)
60-
print("%s removed ..." % fobj)
61-
except OSError:
62-
pass
5+
import semver as package
636

647

658
def read_file(filename):
9+
"""
10+
Read RST file and return content
11+
12+
:param filename: the RST file
13+
:return: content of the RST file
14+
"""
6615
with open(join(dirname(__file__), filename)) as f:
6716
return f.read()
6817

@@ -98,10 +47,10 @@ def read_file(filename):
9847
"Programming Language :: Python :: 3.7",
9948
"Programming Language :: Python :: 3.8",
10049
"Programming Language :: Python :: 3.9",
50+
"Programming Language :: Python :: Implementation :: PyPy",
10151
"Topic :: Software Development :: Libraries :: Python Modules",
10252
],
10353
python_requires=">=3.5.*",
10454
tests_require=["tox", "virtualenv"],
105-
cmdclass={"clean": Clean, "test": Tox},
10655
entry_points={"console_scripts": ["pysemver = semver:main"]},
10756
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy