|
1 | 1 | #!/usr/bin/env python
|
2 |
| -import semver as package |
3 |
| -from glob import glob |
4 |
| -from os import remove |
5 | 2 | from os.path import dirname, join
|
6 | 3 | 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 |
31 | 4 |
|
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 |
63 | 6 |
|
64 | 7 |
|
65 | 8 | 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 | + """ |
66 | 15 | with open(join(dirname(__file__), filename)) as f:
|
67 | 16 | return f.read()
|
68 | 17 |
|
@@ -98,10 +47,10 @@ def read_file(filename):
|
98 | 47 | "Programming Language :: Python :: 3.7",
|
99 | 48 | "Programming Language :: Python :: 3.8",
|
100 | 49 | "Programming Language :: Python :: 3.9",
|
| 50 | + "Programming Language :: Python :: Implementation :: PyPy", |
101 | 51 | "Topic :: Software Development :: Libraries :: Python Modules",
|
102 | 52 | ],
|
103 | 53 | python_requires=">=3.5.*",
|
104 | 54 | tests_require=["tox", "virtualenv"],
|
105 |
| - cmdclass={"clean": Clean, "test": Tox}, |
106 | 55 | entry_points={"console_scripts": ["pysemver = semver:main"]},
|
107 | 56 | )
|
0 commit comments