[gimp-web/testing] Add download-template python defs to config file



commit cc908551c598b2e17e39568947abea0d2d71ec14
Author: Pat David <patdavid gmail com>
Date:   Mon Jul 25 14:42:57 2016 -0500

    Add download-template python defs to config file
    
    Add the VERSION parsing at the end of the config file for
    use in the download page templates.

 pelicanconf.testing.py |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/pelicanconf.testing.py b/pelicanconf.testing.py
index 35390f6..09eb484 100644
--- a/pelicanconf.testing.py
+++ b/pelicanconf.testing.py
@@ -33,7 +33,7 @@ AUTHOR = u'Pat David'
 SITENAME = u'GIMP'
 SITEURL = '//testing.gimp.org'
 SITEMAP_SITEURL = 'https://testing.gimp.org'
-GIMP_VERSION = u'2.8.18'
+#GIMP_VERSION = u'2.8.18'
 
 PATH = 'content'
 
@@ -121,3 +121,38 @@ PAGES_DEBUG = False
 # When developing, you probably want document relative URLs - so set this to True
 # When publishing, set to False
 RELATIVE_URLS = True
+
+#
+# Parse the GIMP_VERSIONS json file for use around the site
+# (mostly the /downloads/index.html page)
+#
+
+import json
+from collections import OrderedDict
+with open('GIMP_VERSIONS') as data:
+    GIMP = json.load(data, object_pairs_hook=OrderedDict)
+
+if 'STABLE' in GIMP:
+    # Set the current stable GIMP version from
+    # the GIMP_VERSIONS json file.  The most
+    # current version _should_ be the first key
+    # hence, .keys()[0]
+    GIMP_VERSION = GIMP['STABLE'].keys()[0]
+    for version, info in GIMP['STABLE'].iteritems() :
+        if 'windows' in info: 
+            try:
+                WINDOWS_FILE
+            except NameError:
+                WINDOWS_VER = version
+                WINDOWS_FILE = info['windows'].keys()[0]
+                WINDOWS_HASH = info['windows'].values()[0]
+        if 'macos' in info:
+            try:
+                MACOS_FILE
+            except NameError:
+                MACOS_VER = version
+                MACOS_FILE = info['macos'].keys()[0]
+                MACOS_HASH = info['macos'].values()[0]
+else:
+    print 'STABLE not defined'
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]