Bugfixes and improved setup logic

This commit is contained in:
Sven Heidemann 2020-12-15 23:10:31 +01:00
parent 8c531ebd11
commit 97b4f516a8
6 changed files with 41 additions and 6 deletions

View File

@ -1,2 +1,2 @@
python setup.py install # for install
python setup.py sdist bdist # for build
python setup.py sdist bdist_wheel # for build

26
requirements.txt Normal file
View File

@ -0,0 +1,26 @@
aiohttp==3.6.3
async-timeout==3.0.1
attrs==20.3.0
certifi==2020.11.8
chardet==3.0.4
click==7.1.2
dateutils==0.6.12
discord==1.0.1
discord.py==1.5.1
Flask==1.1.2
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
keyboard==0.13.5
MarkupSafe==1.1.1
multidict==4.7.6
mysql-connector==2.2.9
overloading==0.5.0
python-dateutil==2.8.1
pytz==2020.4
six==1.15.0
SQLAlchemy==1.3.20
termcolor==1.1.0
urllib3==1.26.2
Werkzeug==1.0.1
yarl==1.5.1

2
src/MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
include ../ README
recursive-include sh_edraft *.txt

View File

@ -8,6 +8,7 @@ setuptools.setup(
license='MIT',
author='Sven Heidemann',
author_email='edraft.sh@gmail.com',
include_package_data=True,
description='sh-edraft python common lib',
python_requires='>=3.8',
install_requires=[

View File

@ -10,6 +10,7 @@ class CLI:
def setup(self):
self._commands[CLICommands.new.__name__] = CLICommands.new
self._commands[CLICommands.help.__name__] = CLICommands.help
def main(self):
args = sys.argv[1:]

View File

@ -5,7 +5,8 @@ class CLICommands:
@classmethod
def new(cls, args: list[str]):
if not os.path.isdir(f'./templates/{args[0]}'):
rel_path = os.path.dirname(__file__)
if not os.path.isdir(f'{rel_path}/templates/{args[0]}'):
cls.unexpected_command(args[0])
sub_args = args[1:]
@ -13,7 +14,11 @@ class CLICommands:
if len(sub_args) != 1:
cls.unexpected_argument(sub_args[1])
if not (sub_args[0].startswith('.') or sub_args[0].startswith('/')):
full_path = f'./{sub_args[0]}'
else:
full_path = sub_args[0]
name = os.path.basename(full_path)
path = os.path.dirname(full_path)
@ -24,7 +29,7 @@ class CLICommands:
if not os.path.isdir(full_path):
os.makedirs(full_path)
for r, d, f in os.walk(f'./templates/{args[0]}'):
for r, d, f in os.walk(f'{rel_path}/templates/{args[0]}'):
for file in f:
template_content = ''
with open(f'{r}/{file}') as template:
@ -71,7 +76,7 @@ class CLICommands:
pyfile.close()
@staticmethod
def help():
def help(*args):
print('Commands:')
@classmethod