From 191adb9012c21ef0115428c93c03aeb4d4c187cd Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:59:43 +0100 Subject: [PATCH] tweak commandline access --- .github/workflows/test-and-upload-to-testpypi.yml | 2 +- setup.py | 6 +++++- trueupdate/__init__.py | 12 ++++++++---- trueupdate/command_line.py | 4 ++++ 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 trueupdate/command_line.py diff --git a/.github/workflows/test-and-upload-to-testpypi.yml b/.github/workflows/test-and-upload-to-testpypi.yml index e9312463..d73bc96e 100644 --- a/.github/workflows/test-and-upload-to-testpypi.yml +++ b/.github/workflows/test-and-upload-to-testpypi.yml @@ -6,7 +6,7 @@ name: Test & Upload to TestPyPI on: # Triggers the workflow on push to the master branch push: - branches: [ master ] + branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/setup.py b/setup.py index f686ebf0..da423c5d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="1.0.0", + version="1.0.1", # The packages that constitute your project. # For my project, I have only one - "pydash". @@ -18,6 +18,10 @@ setup( # you can instead use the py_modules field instead. # EITHER py_modules OR packages should be present. packages=find_packages(), + + entry_points = { + 'console_scripts': ['trueupdate=trueupdate.command_line:main'], + } # The description that will be shown on PyPI. # Keep it short and concise diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index ae4dfcd7..1a68eb9f 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -76,6 +76,12 @@ def fetch_charts(): charts = rawcharts.stdout.decode('utf-8') return(charts) +def run() + get_args() + charts = fetch_charts() + parse_charts(charts) + execute_upgrades() + def get_args(): if len(sys.argv) == 3: SEMVER = sys.argv[2] or "minor" @@ -83,8 +89,6 @@ def get_args(): CATALOG = sys.argv[1] or "ALL" if __name__ == '__main__': - get_args() - charts = fetch_charts() - parse_charts(charts) - execute_upgrades() + run() exit(0) + diff --git a/trueupdate/command_line.py b/trueupdate/command_line.py new file mode 100644 index 00000000..ff1879eb --- /dev/null +++ b/trueupdate/command_line.py @@ -0,0 +1,4 @@ +import trueupdate + +def main(): + print trueupdate.run() \ No newline at end of file