From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: bug-gnulib@gnu.org
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
Subject: [PATCH 3/3] vcs-to-changelog: Allow loading of custom quirks file
Date: Thu, 16 Jan 2020 12:49:55 +0530 [thread overview]
Message-ID: <20200116071955.61450-4-siddhesh@gotplt.org> (raw)
In-Reply-To: <20200116071955.61450-1-siddhesh@gotplt.org>
gnulib does not have a quirks file and if the scripts are not copied
over to the project tree, it may never find the quirks file in the
right place. Add a flag to vcs_to_changelog.py to allow one to
specify the location of the quirks file instead.
* build-aux/vcs_to_changelog.py: New commandline option -q.
---
build-aux/vcs_to_changelog.py | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/build-aux/vcs_to_changelog.py b/build-aux/vcs_to_changelog.py
index d5931e4e9..bf4bc7cf6 100755
--- a/build-aux/vcs_to_changelog.py
+++ b/build-aux/vcs_to_changelog.py
@@ -78,17 +78,8 @@ class ProjectQuirks:
# header file that is only assembly code, which breaks the C parser.
IGNORE_LIST = ['ChangeLog']
-
-# Load quirks file. We assume that the script is run from the top level source
-# directory.
sys.path.append('/'.join([os.path.dirname(os.path.realpath(__file__)),
'vcstocl']))
-try:
- from vcstocl_quirks import *
- project_quirks = get_project_quirks(debug)
-except:
- project_quirks = ProjectQuirks()
-
def main(repo, frontends, refs):
''' ChangeLog Generator Entry Point.
@@ -107,6 +98,9 @@ if __name__ == '__main__':
parser.add_argument('-d', '--debug', required=False, action='store_true',
help='Run the file parser debugger.')
+ parser.add_argument('-q', '--quirks', required=False, type=str,
+ help='Load a quirks file.')
+
args = parser.parse_args()
debug.debug = args.debug
@@ -115,6 +109,21 @@ if __name__ == '__main__':
debug.eprint('Two refs needed to get a ChangeLog.')
sys.exit(os.EX_USAGE)
+ # Load quirks file. We assume that the script is run from the top level source
+ # directory.
+ if args.quirks:
+ import importlib.util
+ spec = importlib.util.spec_from_file_location("vcstocl_quirks", args.quirks)
+ vcstocl_quirks = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(vcstocl_quirks)
+ project_quirks = vcstocl_quirks.get_project_quirks(debug)
+ else:
+ try:
+ from vcstocl_quirks import *
+ project_quirks = get_project_quirks(debug)
+ except:
+ project_quirks = ProjectQuirks()
+
REPO = {'git': GitRepo(project_quirks.IGNORE_LIST, debug)}
fe_c = frontend_c.Frontend(project_quirks, debug)
--
2.24.1
next prev parent reply other threads:[~2020-01-16 9:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 7:19 [PATCH 0/3] vcs-to-changelog fixes Siddhesh Poyarekar
2020-01-16 7:19 ` [PATCH 1/3] vcs-to-changelog: Drop python3 shebang from frontend_c.py Siddhesh Poyarekar
2020-01-16 7:19 ` [PATCH 2/3] vcs-to-changelog: Fix formatting of ChangeLog ouput Siddhesh Poyarekar
2020-01-16 7:19 ` Siddhesh Poyarekar [this message]
2020-01-16 20:32 ` [PATCH 0/3] vcs-to-changelog fixes Bruno Haible
2020-01-17 3:39 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200116071955.61450-4-siddhesh@gotplt.org \
--to=siddhesh@gotplt.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).