2
2
3
3
import os
4
4
import versioneer
5
- from setuptools import setup
6
- from distutils import log
7
- from distutils .command .clean import clean
8
- from distutils .dir_util import remove_tree
5
+ from setuptools import setup , Command
6
+ from shutil import rmtree
9
7
10
8
base_path = os .path .dirname (os .path .abspath (__file__ ))
11
9
12
-
13
10
long_description = """
14
11
This package consists of a couple of optimised tools for doing things that can roughly be
15
12
considered "group-indexing operations". The most prominent tool is `aggregate`.
25
22
"""
26
23
27
24
28
- class NumpyGroupiesClean (clean ):
29
- """Custom clean command to tidy up the project root."""
25
+ class Clean (Command ):
26
+ description = "clean up temporary files from 'build' command"
27
+ user_options = []
28
+
29
+ def initialize_options (self ):
30
+ pass
31
+
32
+ def finalize_options (self ):
33
+ pass
34
+
30
35
def run (self ):
31
- clean .run (self )
32
- for folder in ('build' , 'numpy_groupies.egg-info' ):
36
+ for folder in ('build' , 'dist' , 'intnan.egg-info' ):
33
37
path = os .path .join (base_path , folder )
34
38
if os .path .isdir (path ):
35
- remove_tree (path , dry_run = self .dry_run )
36
- if not self .dry_run :
37
- self ._rm_walk ()
39
+ print ("removing '{}' (and everything under it)" .format (path ))
40
+ if not self .dry_run :
41
+ rmtree (path )
42
+ self ._rm_walk ()
38
43
39
44
def _rm_walk (self ):
40
45
for path , dirs , files in os .walk (base_path ):
41
46
if any (p .startswith ('.' ) for p in path .split (os .path .sep )):
42
47
# Skip hidden directories like the git folder right away
43
48
continue
44
49
if path .endswith ('__pycache__' ):
45
- remove_tree (path , dry_run = self .dry_run )
50
+ print ("removing '{}' (and everything under it)" .format (path ))
51
+ if not self .dry_run :
52
+ rmtree (path )
46
53
else :
47
54
for fname in files :
48
55
if fname .endswith ('.pyc' ) or fname .endswith ('.so' ):
49
56
fpath = os .path .join (path , fname )
50
- os .remove (fpath )
51
- log .info ("removing '%s'" , fpath )
57
+ print ("removing '{}'" .format (fpath ))
58
+ if not self .dry_run :
59
+ os .remove (fpath )
52
60
53
61
54
62
setup (name = 'numpy_groupies' ,
@@ -62,15 +70,13 @@ def _rm_walk(self):
62
70
download_url = "https://github.com/ml31415/numpy-groupies/archive/master.zip" ,
63
71
keywords = [ "accumarray" , "aggregate" , "groupby" , "grouping" , "indexing" ],
64
72
packages = ['numpy_groupies' ],
65
- install_requires = [],
66
- setup_requires = ['pytest-runner' ],
67
- tests_require = ['pytest' , 'numpy' , 'numba' ],
73
+ install_requires = ['numpy' , 'numba' ],
74
+ extras_require = {'tests' : ['pytest' ]},
68
75
classifiers = ['Development Status :: 4 - Beta' ,
69
76
'Intended Audience :: Science/Research' ,
70
77
'Programming Language :: Python :: 3.7' ,
71
78
'Programming Language :: Python :: 3.8' ,
72
79
'Programming Language :: Python :: 3.9' ,
73
- 'Programming Language :: Python :: 3.10' ,
74
- ],
75
- cmdclass = dict (clean = NumpyGroupiesClean , ** versioneer .get_cmdclass ()),
80
+ 'Programming Language :: Python :: 3.10' ],
81
+ cmdclass = dict (clean = Clean , ** versioneer .get_cmdclass ()),
76
82
)
0 commit comments