-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.py
More file actions
38 lines (28 loc) · 857 Bytes
/
scripts.py
File metadata and controls
38 lines (28 loc) · 857 Bytes
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
import os
import shutil
from contextlib import suppress
import dotenv
import setuptools
from pymenu import Menu
def clear_build():
folders = ['build', 'dist', 'pymenu_console.egg-info']
for folder in folders:
with suppress(FileNotFoundError):
shutil.rmtree(folder)
def show_packages():
print(setuptools.find_packages())
def deploy():
clear_build()
token = dotenv.get_key('.env', 'PYPI_TOKEN')
os.system('python setup.py sdist bdist_wheel')
os.system(f'twine upload -u __token__ -p {token} dist/*')
clear_build()
menu = Menu('Scripts')
menu.add_options([
('build', lambda: os.system('python setup.py sdist bdist_wheel')),
('package', lambda: os.system('twine upload dist/*')),
('clear build', clear_build),
('show packages', show_packages),
('deploy', deploy),
])
menu.show()