From 2e13d75f90a689291fb717f3f4a9d843cccc12b9 Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Wed, 4 Dec 2019 22:43:29 +0100 Subject: [PATCH] Added code for packaging the stuff --- .gitignore | 113 +++++++++++++++++++++++++++++++++++++++ __main__.py | 3 ++ listgits.py | 26 +++++---- listgits_pkg/__init__.py | 6 +++ setup.py | 22 ++++++++ 5 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 __main__.py create mode 100644 listgits_pkg/__init__.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index b011a11..2e1db26 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,116 @@ healthchecksdb MigrationBackup/ # End of https://www.gitignore.io/api/visualstudio + +## Python ignores + +# Created by https://www.gitignore.io/api/python +# Edit at https://www.gitignore.io/?templates=python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# End of https://www.gitignore.io/api/python + diff --git a/__main__.py b/__main__.py new file mode 100644 index 0000000..c950e51 --- /dev/null +++ b/__main__.py @@ -0,0 +1,3 @@ +import listgits + +listgits.main() diff --git a/listgits.py b/listgits.py index 6c44dcd..b2b2b77 100644 --- a/listgits.py +++ b/listgits.py @@ -32,19 +32,23 @@ def listgits(cwd,level,s,local,remotes): listgits(root,level,s,local,remotes) os.chdir(root) -parser = argparse.ArgumentParser() -parser.add_argument("--s",action="store_true",help="Output results in short form, ignoring non-git folders") -parser.add_argument("--l",action="store_true",help="Show only local repos") -parser.add_argument("--r",action="store_true",help="Show only repos with remotes") +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--s",action="store_true",help="Output results in short form, ignoring non-git folders") + parser.add_argument("--l",action="store_true",help="Show only local repos") + parser.add_argument("--r",action="store_true",help="Show only repos with remotes") -args = parser.parse_args() + args = parser.parse_args() -short = args.s -local = args.l -remotes = args.r -if not short and (local or remotes): - short=True + short = args.s + local = args.l + remotes = args.r + if not short and (local or remotes): + short=True -listgits('./',0,short,local,remotes) + listgits('./',0,short,local,remotes) + +if __name__ == "__main__": + main() diff --git a/listgits_pkg/__init__.py b/listgits_pkg/__init__.py new file mode 100644 index 0000000..4c7e816 --- /dev/null +++ b/listgits_pkg/__init__.py @@ -0,0 +1,6 @@ +from listgits import listgits + +def main(): + listgits.main() + + \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e95a59c --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="listgits-pkg-osirsiterje", + version="0.3.1", + author="Terje Sandstrom", + author_email="terje@hermit.no", + description="Python command line program for listing all git repositories under a folder root", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/OsirisTerje/listgits", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', +) \ No newline at end of file