| |
@@ -5,6 +5,9 @@
|
| |
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 @@
|
| |
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 @@
|
| |
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('<!ENTITY YEAR "%s">\n' % datetime.datetime.now().year)
|
| |
+
|
| |
+ custom_settings.write('<!ENTITY PRODUCT "%s">\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('<!ENTITY NEXTVER "%s">\n' % nextver)
|
| |
+ custom_settings.write('<!ENTITY PRODVER "%s">\n' % linux_distribution[1])
|
| |
+ custom_settings.write('<!ENTITY PREVVER "%s">\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('<!ENTITY url="%s/enter_bug.cgi?product=%s;&component=&BOOKID;">%s</ulink>\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))
|
| |
This automatically pulls in values from /etc/os-release (if souced). It should reduce the need to constantly update en-US/Installation_Guide.ent for just version number bumps. It is also compatible with RHEL versioning strings.
Must add source /etc/os-release to spec before running prepare_anaconda_help_content.py