summaryrefslogtreecommitdiffstats
path: root/pyanaconda/product.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2010-10-21 16:47:03 -0400
committerChris Lumens <clumens@redhat.com>2010-10-21 16:58:37 -0400
commitecd5fe3d9cd90f38fcb9704a878cede4cacf079a (patch)
tree877ee3d62f2196aaf4a78c80b263dd7a203dc7cb /pyanaconda/product.py
parent67605ee53bdf4453b469e74ca1759b1797f1ef93 (diff)
downloadanaconda-ecd5fe3d9cd90f38fcb9704a878cede4cacf079a.tar.gz
anaconda-ecd5fe3d9cd90f38fcb9704a878cede4cacf079a.tar.xz
anaconda-ecd5fe3d9cd90f38fcb9704a878cede4cacf079a.zip
Allow importing product.py in places where you won't have a .buildstamp.
If you're running anaconda through some external testing system, you're not going to have a .buildstamp file. However, the defaults dict for the ConfigParser object doesn't allow for putting those defaults into a section so all the later lookups will fail due to lack of a Main. Moving to a big block of .set calls fixes this up.
Diffstat (limited to 'pyanaconda/product.py')
-rw-r--r--pyanaconda/product.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/pyanaconda/product.py b/pyanaconda/product.py
index 49ec57311..ad17afb90 100644
--- a/pyanaconda/product.py
+++ b/pyanaconda/product.py
@@ -22,26 +22,27 @@ import os
# First, load in the defaults. In order of precedence: contents of
# .buildstamp, environment, stupid last ditch hardcoded defaults.
-config = ConfigParser.ConfigParser({"Arch": os.environ.get("ANACONDA_PRODUCTARCH", ""),
- "BugURL": os.environ.get("ANACONDA_BUGURL", "your distribution provided bug reporting tool"),
- "IsBeta": os.environ.get("ANACONDA_ISBETA", "true").lower() == "true",
- "Product": os.environ.get("ANACONDA_PRODUCTNAME", "anaconda"),
- "UUID": "",
- "Version": os.environ.get("ANACONDA_PRODUCTVERSION", "bluesky")}
- )
+config = ConfigParser.ConfigParser()
+config.add_section("Main")
+config.set("Main", "Arch", os.environ.get("ANACONDA_PRODUCTARCH", os.uname()[4]))
+config.set("Main", "BugURL", os.environ.get("ANACONDA_BUGURL", "your distribution provided bug reporting tool"))
+config.set("Main", "IsBeta", os.environ.get("ANACONDA_ISBETA", "true"))
+config.set("Main", "Product", os.environ.get("ANACONDA_PRODUCTNAME", "anaconda"))
+config.set("Main", "UUID", "")
+config.set("Main", "Version", os.environ.get("ANACONDA_PRODUCTVERSION", "bluesky"))
# Now read in the .buildstamp file, wherever it may be.
config.read(["/tmp/product/.buildstamp", "/.buildstamp", os.environ.get("PRODBUILDPATH", "")])
# Set up some variables we import throughout, applying a couple transforms as necessary.
bugUrl = config.get("Main", "BugURL")
-isBeta = config.get("Main", "IsBeta").lower() != "false"
+isBeta = config.getboolean("Main", "isBeta")
productArch = config.get("Main", "Arch")
productName = config.get("Main", "Product")
productStamp = config.get("Main", "UUID")
productVersion = config.get("Main", "Version")
-if not productArch:
+if not productArch and productStamp.index(".") != -1:
productArch = productStamp[productStamp.index(".")+1:]
if productVersion == "development":
productVersion = "rawhide"