From e59e1d510f7d75b600fc4f40c928514135d8d39f Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Mon, 18 Nov 2019 16:10:33 +0100 Subject: [PATCH] move code to distgit_bugzilla_sync package This allows as to have different functionality, e.g. handling configuration, in their own separate modules. Use relative imports for project-internal modules and remove shebangs from them as they're not marked executable anyway. Instead, add run-distgit-bugzilla-sync for testing from the repo worktree. Signed-off-by: Nils Philippsen --- distgit_bugzilla_sync/__init__.py | 0 .../package_summary.py | 3 --- pagure_sync_bugzilla.py => distgit_bugzilla_sync/script.py | 3 +-- run-distgit-bugzilla-sync | 5 +++++ setup.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 distgit_bugzilla_sync/__init__.py rename package_summary.py => distgit_bugzilla_sync/package_summary.py (99%) rename pagure_sync_bugzilla.py => distgit_bugzilla_sync/script.py (99%) create mode 100755 run-distgit-bugzilla-sync diff --git a/distgit_bugzilla_sync/__init__.py b/distgit_bugzilla_sync/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/package_summary.py b/distgit_bugzilla_sync/package_summary.py similarity index 99% rename from package_summary.py rename to distgit_bugzilla_sync/package_summary.py index 5319b27..d900559 100644 --- a/package_summary.py +++ b/distgit_bugzilla_sync/package_summary.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 -tt - """ This module provides the functionality to download the latest primary.xml database from koji on the rawhide repo. @@ -12,7 +10,6 @@ which can then later be re-used in other places. This prevents relying on remote services such as mdapi (of which a lot of code here is coming from) when needing to access the summary of a lot of packages. - """ import contextlib import hashlib diff --git a/pagure_sync_bugzilla.py b/distgit_bugzilla_sync/script.py similarity index 99% rename from pagure_sync_bugzilla.py rename to distgit_bugzilla_sync/script.py index 9228da0..dcd56ba 100644 --- a/pagure_sync_bugzilla.py +++ b/distgit_bugzilla_sync/script.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 -tt # -*- coding: utf-8 -*- # # Copyright © 2013-2019 Red Hat, Inc. @@ -53,7 +52,7 @@ from requests.adapters import HTTPAdapter from urllib3.util import Retry import yaml -import package_summary +from . import package_summary env = 'staging' diff --git a/run-distgit-bugzilla-sync b/run-distgit-bugzilla-sync new file mode 100755 index 0000000..8482c2f --- /dev/null +++ b/run-distgit-bugzilla-sync @@ -0,0 +1,5 @@ +#!/usr/bin/python3 -tt + +from distgit_bugzilla_sync.script import main + +main() diff --git a/setup.py b/setup.py index 546e4b7..b1fd094 100644 --- a/setup.py +++ b/setup.py @@ -33,14 +33,14 @@ setup( platforms=['Fedora', 'GNU/Linux'], url='https://pagure.io/Fedora-Infra/distgit-bugzilla-sync', keywords='fedora', - packages=[], + packages=['distgit_bugzilla_sync'], include_package_data=True, zip_safe=False, install_requires=INSTALL_REQUIRES, tests_require=TESTS_REQUIRE, entry_points={ 'console_scripts': [ - 'distgit-bugzilla-sync = pagure_sync_bugzilla:main', + 'distgit-bugzilla-sync = distgit_bugzilla_sync.script:main', ], }, )