diff --git a/setup.py b/setup.py index ede466e..0c99503 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,53 @@ +import argparse +from distutils.command.clean import clean +import os +import shutil +import sys + import PyInstaller.__main__ -name = 'diceplayer' +name = "diceplayer" -PyInstaller.__main__.run([ - 'diceplayer/__main__.py', - '--onefile', - '-n{}'.format(name) -]) \ No newline at end of file +parser = argparse.ArgumentParser(prog="Diceplayer Setup") + +parser.add_argument( + "-b", "--build", + dest="build", + default=False, + action="store_true", + help="Builds the Diceplayer Binary", +) +parser.add_argument( + "-c", "--clean", + dest="clean", + default=False, + action="store_true", + help="Cleans the Development Environment", +) + +args = parser.parse_args() + + +def __build(): + + PyInstaller.__main__.run( + ["diceplayer/__main__.py", "--onefile", "-n{}".format(name)] + ) + + +def __clean(): + + shutil.rmtree("build") + shutil.rmtree("dist") + os.remove("diceplayer.spec") + + +if __name__ == "__main__": + + if args.build: + __build() + elif args.clean: + __clean() + else: + parser.print_help(sys.stderr) + sys.exit(1)