-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
38 lines (32 loc) · 1.31 KB
/
Copy pathsetup.py
File metadata and controls
38 lines (32 loc) · 1.31 KB
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
from setuptools import setup, Command
import os
class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# Directories to exclude from cleaning
exclude_dirs = {'.pyenv', '.git'}
for root, dirs, files in os.walk("./", topdown=True):
# Remove excluded directories from dirs list to prevent os.walk from traversing them
dirs[:] = [d for d in dirs if d not in exclude_dirs]
for name in files:
if name.endswith((".pyc", ".tgz", ".whl")):
print("remove {}".format(os.path.join(root, name)))
os.remove(os.path.join(root, name))
for name in dirs:
if name.endswith((".egg-info", "build", "dist", "__pycache__", "html")):
print("remove {}".format(os.path.join(root, name)))
#os.rmdir(os.path.join(root, name))
os.system('rm -vrf {}'.format(os.path.join(root, name)))
# Most configuration is in pyproject.toml
setup(
name='soft_fido2',
version='0.4.%s' % os.environ.get('GITHUB_RUN_NUMBER', 0),
cmdclass={
'clean': CleanCommand,
}
)