|
1 | | -#!/usr/bin/env python |
| 1 | +#!/usr/bin/env python3 |
2 | 2 | import semver as package |
3 | | -from glob import glob |
4 | | -from os import remove |
5 | 3 | from os.path import dirname, join |
6 | 4 | 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 | | - |
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 |
63 | 5 |
|
64 | 6 |
|
65 | 7 | def read_file(filename): |
@@ -92,17 +34,15 @@ def read_file(filename): |
92 | 34 | "License :: OSI Approved :: BSD License", |
93 | 35 | "Operating System :: OS Independent", |
94 | 36 | "Programming Language :: Python", |
95 | | - "Programming Language :: Python :: 2", |
96 | | - "Programming Language :: Python :: 2.7", |
97 | 37 | "Programming Language :: Python :: 3", |
98 | | - "Programming Language :: Python :: 3.4", |
99 | | - "Programming Language :: Python :: 3.5", |
100 | 38 | "Programming Language :: Python :: 3.6", |
101 | 39 | "Programming Language :: Python :: 3.7", |
| 40 | + "Programming Language :: Python :: 3.8", |
| 41 | + "Programming Language :: Python :: 3.9", |
| 42 | + # "Programming Language :: Python :: Implementation :: PyPy", |
102 | 43 | "Topic :: Software Development :: Libraries :: Python Modules", |
103 | 44 | ], |
104 | | - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", |
| 45 | + python_requires=">=3.6.*", |
105 | 46 | tests_require=["tox", "virtualenv"], |
106 | | - cmdclass={"clean": Clean, "test": Tox}, |
107 | 47 | entry_points={"console_scripts": ["pysemver = semver:main"]}, |
108 | 48 | ) |
0 commit comments