public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: doc/
Date: Wed, 28 Oct 2015 16:50:40 +0000 (UTC)	[thread overview]
Message-ID: <1446050996.6a38e62e143df9bda84da1ce8a54948c57e833fa.vapier@gentoo> (raw)

commit:     6a38e62e143df9bda84da1ce8a54948c57e833fa
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 12 00:55:05 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Oct 28 16:49:56 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=6a38e62e

make_target_table: rewrite for py3/stability

 doc/make_target_table.py | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/doc/make_target_table.py b/doc/make_target_table.py
index f127c37..9eb072b 100755
--- a/doc/make_target_table.py
+++ b/doc/make_target_table.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/python
 # Copyright (C) 2012 W. Trevor King <wking@drexel.edu>
 # Copyright (C) 2012 Sebastian Pipping <sebastian@pipping.org>
 # Copyright (C) 2013 Brian dolbec <dolsen@gentoo.org>
@@ -10,34 +10,38 @@
 
 from __future__ import print_function
 
-import sys as _sys
-
 import glob
-import re
+import locale
+import os
+import sys
 
 
-def key_netboot_before_netboot2((target_name, _module)):
-	return target_name + '1'
+def main(_argv):
+	source_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
 
+	# Force consistent sorting order.
+	locale.setlocale(locale.LC_COLLATE, 'C')
 
-if __name__ == '__main__':
-	extractor = re.compile('^catalyst/targets/(([^ ]+)).py$')
 	targets = list()
-	for filename in sorted(glob.glob('catalyst/targets/*.py')):
+	for filename in glob.glob(os.path.join(source_root, 'catalyst/targets/*.py')):
 		if '__init__' in filename:
 			continue
 
-		match = extractor.match(filename)
-		target_name = match.group(2).replace('_', '-')
-		module_name = 'catalyst.targets.' + match.group(1)
+		name = os.path.basename(filename)[0:-3]
+		target_name = name.replace('_', '-')
+		module_name = 'catalyst.targets.' + name
 
 		__import__(module_name)
-		module = _sys.modules[module_name]
+		module = sys.modules[module_name]
 
 		targets.append((target_name, module))
 
-	for target_name, module in sorted(targets, key=key_netboot_before_netboot2):
+	for target_name, module in sorted(targets, key=lambda x: x[0]):
 		print('`%s`;;' % target_name)
 		# Replace blank lines with `+` (asciidoc list item continuation)
 		print(module.__doc__.strip().replace('\n\n', '\n+\n'))
 		print('')
+
+
+if __name__ == '__main__':
+	main(sys.argv[1:])


             reply	other threads:[~2015-10-28 16:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 16:50 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-05-16  6:43 [gentoo-commits] proj/catalyst:master commit in: doc/ Matt Turner
2020-05-16  6:43 Matt Turner
2020-05-16  6:43 Matt Turner
2020-04-10  6:18 Matt Turner
2020-04-09 18:48 Matt Turner
2020-03-30 23:47 Matt Turner
2018-04-26 15:57 Richard Farina
2017-11-22 15:52 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2017-11-29 17:20 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2017-03-11  2:35 Richard Farina
2015-02-26 20:12 Brian Dolbec
2014-01-03  5:03 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-01-06  2:00 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2013-03-09  2:41 Matt Turner
2013-03-09  2:41 Matt Turner
2012-11-21  5:20 Matt Turner
2012-11-02  0:26 Richard Farina
2012-10-31 22:11 Richard Farina
2011-07-21  4:44 Matt Turner
2011-06-25 18:08 Sebastian Pipping
2011-06-25 18:08 Sebastian Pipping
2011-06-25 18:08 Sebastian Pipping

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446050996.6a38e62e143df9bda84da1ce8a54948c57e833fa.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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