From d63fba7c79d06b9730a9c74b593f916deb98b282 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Apr 17 2017 15:43:36 +0000 Subject: Read in values from os-release if present. Must add source /etc/os-release to spec before running prepare_anaconda_help_content.py --- diff --git a/en-US/Installation_Guide.ent b/en-US/Installation_Guide.ent index 4f4a9f3..aef6dc0 100644 --- a/en-US/Installation_Guide.ent +++ b/en-US/Installation_Guide.ent @@ -1,9 +1,3 @@ - - - - - -https://bugzilla.redhat.com" > '> diff --git a/prepare_anaconda_help_content.py b/prepare_anaconda_help_content.py index 09e3c42..de81b28 100755 --- a/prepare_anaconda_help_content.py +++ b/prepare_anaconda_help_content.py @@ -5,6 +5,9 @@ import os import shutil import glob import subprocess +import platform +import datetime + # we are using lxml as unlike in the Python built-in ElementTree elements # in the lxml tree know their parents - this is handy when removing the figure tags from lxml import etree as ET @@ -12,6 +15,7 @@ from lxml import etree as ET PLACEHOLDERS = ["FedoraPlaceholderWithLinks.html", "FedoraPlaceholder.html", "FedoraPlaceholder.txt"] INPUT_FOLDER = "en-US" OUTPUT_FOLDER = "anaconda_help_content/en-US" +XML_DEFINES = "Installation_Guide.ent" # list of the XML help content & supporting files Anaconda currently cares about ANACONDA_HELP_FILES = [ @@ -79,6 +83,27 @@ for file_name in ANACONDA_HELP_FILES: print("WARNING: required file %s is missing" % origin) shutil.copy(origin, destination) +print("setting platform specifics") +linux_distribution = platform.linux_distribution() +with open(OUTPUT_FOLDER + '/' + XML_DEFINES, 'a') as custom_settings: + custom_settings.write('\n' % datetime.datetime.now().year) + + custom_settings.write('\n' % linux_distribution[0]) + if int(float(linux_distribution[1])) == linux_distribution[1]: + nextver = int(linux_distribution[1]) + 1 + prevver = int(linux_distribution[1]) - 1 + else: + nextver = float(linux_distribution[1]) + 0.1 + prevver = float(linux_distribution[1]) - 0.1 + custom_settings.write('\n' % nextver) + custom_settings.write('\n' % linux_distribution[1]) + custom_settings.write('\n' % prevver) + + if 'BUG_REPORT_URL' in os.environ: + if 'REDHAT_BUGZILLA_PRODUCT' in os.environ: + if os.environ['BUG_REPORT_URL'].startswith('http'): + custom_settings.write('%s\n' % (os.environ['BUG_REPORT_URL'], os.environ['REDHAT_BUGZILLA_PRODUCT'], os.environ['BUG_REPORT_URL'])) + print("removing non breakable spaces") for path in glob.glob(os.path.join(OUTPUT_FOLDER, "*.ent")): os.system("sed 's/ / /g' -i %s %s" % (path, path))