* [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python
@ 2013-10-13 9:07 Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 2/4] Catalyst: use a more pythonic method to import modules Dylan Baker
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dylan Baker @ 2013-10-13 9:07 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Dylan Baker
This allows catalyst to work regardless of whether a user prefers that
usr/bin/python be python 2.x or 3.x.
---
catalyst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/catalyst b/catalyst
index 4550d05..11560fb 100755
--- a/catalyst
+++ b/catalyst
@@ -1,4 +1,4 @@
-#!/usr/bin/python -OO
+#!/usr/bin/python2 -OO
# Maintained in full by:
# Catalyst Team <catalyst@gentoo.org>
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-catalyst] [Patch v2 2/4] Catalyst: use a more pythonic method to import modules
2013-10-13 9:07 [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Dylan Baker
@ 2013-10-13 9:07 ` Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 3/4] catalyst: split combined import Dylan Baker
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dylan Baker @ 2013-10-13 9:07 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Dylan Baker
Rather than appending a directory to the system path, this patch adds a
__init__.py file to modules, which allows python to search it, and it's
children for python modules. This also requires changes to a few of the
module files to make them happy.
---
catalyst | 16 ++++++----------
modules/__init__.py | 0
modules/catalyst/config.py | 2 +-
3 files changed, 7 insertions(+), 11 deletions(-)
create mode 100644 modules/__init__.py
diff --git a/catalyst b/catalyst
index 11560fb..2378a87 100755
--- a/catalyst
+++ b/catalyst
@@ -11,12 +11,8 @@ import os, sys, imp, string, getopt
import pdb
import os.path
-__selfpath__ = os.path.abspath(os.path.dirname(__file__))
-
-sys.path.append(__selfpath__ + "/modules")
-
-import catalyst.config
-import catalyst.util
+import modules.catalyst.config
+import modules.catalyst.util
__maintainer__="Catalyst <catalyst@gentoo.org>"
__version__="2.0.14"
@@ -91,7 +87,7 @@ def parse_config(myconfig):
# now, try and parse the config file "config_file"
try:
# execfile(config_file, myconf, myconf)
- myconfig = catalyst.config.ConfigParser(config_file)
+ myconfig = modules.catalyst.config.ConfigParser(config_file)
myconf.update(myconfig.get_values())
except:
@@ -226,7 +222,7 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- catalyst.util.print_traceback()
+ modules.catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
@@ -379,12 +375,12 @@ if __name__ == "__main__":
addlargs={}
if myspecfile:
- spec = catalyst.config.SpecParser(myspecfile)
+ spec = modules.catalyst.config.SpecParser(myspecfile)
addlargs.update(spec.get_values())
if mycmdline:
try:
- cmdline = catalyst.config.ConfigParser()
+ cmdline = modules.catalyst.config.ConfigParser()
cmdline.parse_lines(mycmdline)
addlargs.update(cmdline.get_values())
except CatalystError:
diff --git a/modules/__init__.py b/modules/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/modules/catalyst/config.py b/modules/catalyst/config.py
index 00da343..726bf74 100644
--- a/modules/catalyst/config.py
+++ b/modules/catalyst/config.py
@@ -1,5 +1,5 @@
import re
-from catalyst_support import *
+from modules.catalyst_support import *
class ParserBase:
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-catalyst] [Patch v2 3/4] catalyst: split combined import
2013-10-13 9:07 [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 2/4] Catalyst: use a more pythonic method to import modules Dylan Baker
@ 2013-10-13 9:07 ` Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 4/4] catalyst: Remove commented sections of code Dylan Baker
2013-10-13 20:15 ` [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Brian Dolbec
3 siblings, 0 replies; 5+ messages in thread
From: Dylan Baker @ 2013-10-13 9:07 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Dylan Baker
Combining multiple modules into a single import is discouraged in
python's PEP8 style guide:
"""
Imports should usually be on separate lines, e.g.:
Yes: import os
import sys
No: import sys, os
"""
---
catalyst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/catalyst b/catalyst
index 2378a87..36bd709 100755
--- a/catalyst
+++ b/catalyst
@@ -7,7 +7,11 @@
# Chris Gianelloni <wolf31o2@wolf31o2.org>
# $Id$
-import os, sys, imp, string, getopt
+import os
+import sys
+import imp
+import string
+import getopt
import pdb
import os.path
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-catalyst] [Patch v2 4/4] catalyst: Remove commented sections of code
2013-10-13 9:07 [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 2/4] Catalyst: use a more pythonic method to import modules Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 3/4] catalyst: split combined import Dylan Baker
@ 2013-10-13 9:07 ` Dylan Baker
2013-10-13 20:15 ` [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Brian Dolbec
3 siblings, 0 replies; 5+ messages in thread
From: Dylan Baker @ 2013-10-13 9:07 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Dylan Baker
Code in the upstream tree should either run or it shouldn't be there.
---
catalyst | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/catalyst b/catalyst
index 36bd709..68fa109 100755
--- a/catalyst
+++ b/catalyst
@@ -128,10 +128,6 @@ def parse_config(myconfig):
print "Cleaning autoresume flags support enabled."
conf_values["CLEAR_AUTORESUME"]="1"
-# if "compress" in string.split(conf_values["options"]):
-# print "Compression enabled."
-# conf_values["COMPRESS"]="1"
-
if "distcc" in string.split(conf_values["options"]):
print "Distcc support enabled."
conf_values["DISTCC"]="1"
@@ -164,10 +160,6 @@ def parse_config(myconfig):
print "Snapshot cache support enabled."
conf_values["SNAPCACHE"]="1"
-# if "tarball" in string.split(conf_values["options"]):
-# print "Tarball creation enabled."
-# conf_values["TARBALL"]="1"
-
if "digests" in myconf:
conf_values["digests"]=myconf["digests"]
if "contents" in myconf:
@@ -414,20 +406,3 @@ if __name__ == "__main__":
print "Catalyst aborting...."
raise
sys.exit(2)
-
- #except CatalystError:
- # print
- # print "Catalyst aborting...."
- # sys.exit(2)
- #except KeyError:
- # print "\nproblem with command line or spec file ( Key Error )"
- # print "Key: "+str(sys.exc_value)+" was not found"
- # print "Catalyst aborting...."
- # sys.exit(2)
- #except UnboundLocalError:
- # print
- # print "UnboundLocalError: "+str(sys.exc_value)+" was not found"
- # raise
- # print
- # print "Catalyst aborting...."
- # sys.exit(2)
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python
2013-10-13 9:07 [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Dylan Baker
` (2 preceding siblings ...)
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 4/4] catalyst: Remove commented sections of code Dylan Baker
@ 2013-10-13 20:15 ` Brian Dolbec
3 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2013-10-13 20:15 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Dylan Baker
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Sun, 2013-10-13 at 02:07 -0700, Dylan Baker wrote:
> This allows catalyst to work regardless of whether a user prefers that
> usr/bin/python be python 2.x or 3.x.
> ---
> catalyst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/catalyst b/catalyst
> index 4550d05..11560fb 100755
> --- a/catalyst
> +++ b/catalyst
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python -OO
> +#!/usr/bin/python2 -OO
>
> # Maintained in full by:
> # Catalyst Team <catalyst@gentoo.org>
Ha!, turns out for all my ranting in the other thread. I already did
this myself.
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f3f05b465f0b2f45649ff07c7f23582fc9fb2322
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-13 20:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-13 9:07 [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 2/4] Catalyst: use a more pythonic method to import modules Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 3/4] catalyst: split combined import Dylan Baker
2013-10-13 9:07 ` [gentoo-catalyst] [Patch v2 4/4] catalyst: Remove commented sections of code Dylan Baker
2013-10-13 20:15 ` [gentoo-catalyst] [Patch v2 1/4] catalyst: Specify python2 rather than the generic python Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox