[gimp-web/testing] pelicanconf*: merge all pelicanconf into one file.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-web/testing] pelicanconf*: merge all pelicanconf into one file.
- Date: Sun, 26 Jan 2020 14:00:40 +0000 (UTC)
commit 8a6f14df4a53a8cbc9c06b7abe3a0b22eb23214a
Author: Jehan <jehan girinstud io>
Date: Sun Jan 26 14:52:27 2020 +0100
pelicanconf*: merge all pelicanconf into one file.
Maintaining 3 nearly-identical files is bug-prone (a bug on production
may not exist on testing or local build, etc.) and also makes it harder
to see what are the difference between the 3 environments.
Instead, let's just have a common file included in all environments,
with just a function to be called which will tweak the few details which
need to be.
pelicanconf.local.py | 295 +------------------------------------------
pelicanconf.py | 285 +----------------------------------------
pelicanconf.testing.py | 285 +----------------------------------------
pelicanconf_common.py | 337 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 346 insertions(+), 856 deletions(-)
---
diff --git a/pelicanconf.local.py b/pelicanconf.local.py
index dd2233b2..47616ed0 100644
--- a/pelicanconf.local.py
+++ b/pelicanconf.local.py
@@ -1,295 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
-from __future__ import unicode_literals
-#Plugins
-PLUGIN_PATHS = ["plugins"]
-#PLUGINS = ["page_hierarchy_gimp"]
-PLUGINS = ["mimic_hierarchy", "i18n_subsites", "sitemap", "gimp_mirrors", "tipue_search", "random_header"]
-
-# sitemap plugin settings
-SITEMAP = {
- 'format': 'xml',
- 'priorities': {
- 'articles': 1,
- 'indexes': 0.5,
- 'pages': 1
- },
- 'changefreqs': {
- 'articles': 'weekly',
- 'indexes': 'weekly',
- 'pages': 'weekly'
- }
-}
-
-# mapping: language_code -> settings_overrides_dict
-I18N_SUBSITES = {
- 'fr': {
- 'SITENAME': 'GIMP FR',
- },
- 'ar': {
- 'SITENAME': 'GIMP AR',
- },
- }
-
-AUTHOR = u'Pat David'
-SITENAME = u'GIMP'
-SITEURL = 'https://www.gimp.org'
-SITEMAP_SITEURL = 'https://www.gimp.org'
-#GIMP_VERSION = u'2.8.20'
-
-PATH = 'content'
-
-TIMEZONE = 'Europe/Paris'
-DEFAULT_LANG = u'en'
-DEFAULT_DATE_FORMAT = "%Y-%m-%d"
-
-# Allow dating news posts in the future
-# before then, they will automatically have
-# Status: draft set
-WITH_FUTURE_DATES = False
-
-# Feed generation is usually not desired when developing
-#FEED_DOMAIN = SITEURL
-#FEED_ATOM = 'feeds/atom.xml'
-#FEED_RSS = 'feeds/rss.xml'
-#FEED_ALL_ATOM = 'feeds/all.atom.xml'
-#CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
-#TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml'
-#TRANSLATION_FEED_RSS = 'feeds/all-%s.rss.xml'
-#AUTHOR_FEED_ATOM = None
-#AUTHOR_FEED_RSS = None
-
-# # Blogroll
-# LINKS = (('Pelican', 'http://getpelican.com/'),
-# ('Python.org', 'http://python.org/'),
-# ('Jinja2', 'http://jinja.pocoo.org/'),
-# ('You can modify those links in your config file', '#'),)
-#
-# # Social widget
-# SOCIAL = (('You can add links in your config file', '#'),
-# ('Another social link', '#'),)
-
-DEFAULT_PAGINATION = False
-
-
-
-# Pat David changes while building/testing
-READERS = {'html': None}
-
-# This will copy over these folders w/o modification
-STATIC_PATHS = ['images', 'js', 'pages', 'tutorials', 'about', 'books', 'develop', 'docs', 'donating',
'downloads', 'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix',
'robots.txt', 'COPYING', 'GNUGPLv2', 'GNUGPLv3', 'news', 'contribute.json', '.htaccess', 'gimp_versions.json']
-
-# This sets which directories will be parsed as pages (vs. news/articles)
-# If a new directory is to be added under content/, make sure it gets added here.
-PAGE_PATHS = ['about', 'frontpage', 'tutorials', 'books', 'develop', 'docs', 'donating', 'downloads',
'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix', 'search.md', 'registry']
-
-ARTICLE_PATHS = ['news']
-
-THEME = "./themes/newgimp"
-
-PAGE_URL = "{slug}/"
-#PAGE_SAVE_AS = "{slug}/index.html"
-PAGE_SAVE_AS = "{slug}/{filename}"
-
-ARTICLE_URL = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/"
-ARTICLE_SAVE_AS = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"
-
-# This redirects the old standard output of blog/news/articles post
-# summaries on the front page. It will now appear at the location
-# below instead.
-# The _actual_ index.html page is located at:
-# content/pages/index.md -> which simply calls the home.html template
-# See: http://docs.getpelican.com/en/3.6.3/faq.html#how-can-i-use-a-static-page-as-my-home-page
-# This sets the "old" index.html page to be saved to /news/index.html.
-INDEX_SAVE_AS = "/news/index.html"
-
-
-TYPOGRIFY = True
-TYPOGRIFY_IGNORE_TAGS = ['title']
-
-#DELETE_OUTPUT_DIRECTORY = True
-
-MD_EXTENSIONS = ['fenced_code', 'codehilite(css_class=codehilite)', 'extra', 'headerid',
'toc(permalink=True)']
-
-# Pagination testing stuff
-
-DEFAULT_ORPHANS = 0
-DEFAULT_PAGINATION = 10
-
-# Debug output on pages
-# Seting to 'True' will show child/parent pages at bottom of pages
-PAGES_DEBUG = False
-
-# When developing, you probably want document relative URLs - so set this to True
-# When publishing, set to False
-RELATIVE_URLS = True
-
-
-#
-# Caching build for faster regeneration
-#
-
-LOAD_CONTENT_CACHE = True
-CHECK_MODIFIED_METHOD = 'mtime'
-CACHE_CONTENT = True
-
-
-###########################################################
-# Functions below for pushing data to the build system
-###########################################################
-
-#
-# 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('content/gimp_versions.json') 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.
- GIMP_VERSION = GIMP['STABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
- for info in GIMP['STABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE
- except NameError:
- RELEASE_DATE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE
- except NameError:
- WINDOWS_VER = version
- WINDOWS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'md5'
- WINDOWS_HASH = info['windows'][0][WINDOWS_HASH_FUN]
- if 'min-support' in info['windows'][0]:
- WINDOWS_MIN_SUPPORT = info['windows'][0]["min-support"]
- if 'macos' in info:
- try:
- MACOS_FILE
- except NameError:
- MACOS_VER = version
- MACOS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN = 'md5'
- MACOS_HASH = info['macos'][0][MACOS_HASH_FUN]
- if 'min-support' in info['macos'][0]:
- MACOS_MIN_SUPPORT = info['macos'][0]["min-support"]
-else:
- print 'STABLE not defined'
-
-if 'OLDSTABLE' in GIMP:
- # Set the current stable GIMP version from
- # the GIMP_VERSIONS json file. The most
- # current version _should_ be the first key.
- GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.',
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
- for info in GIMP['OLDSTABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_OLDSTABLE
- except NameError:
- RELEASE_DATE_OLDSTABLE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_OLDSTABLE
- except NameError:
- WINDOWS_VER_OLDSTABLE = version
- WINDOWS_MAJOR_MINOR_VER_OLDSTABLE = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE_OLDSTABLE = info['windows'][0]['filename']
- WINDOWS_HASH_OLDSTABLE = info['windows'][0]['md5']
- if 'macos' in info:
- try:
- MACOS_FILE_OLDSTABLE
- except NameError:
- MACOS_VER_OLDSTABLE = version
- MACOS_MAJOR_MINOR_VER_OLDSTABLE= version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE_OLDSTABLE = info['macos'][0]['filename']
- MACOS_HASH_OLDSTABLE = info['macos'][0]['md5']
-else:
- print 'OLDSTABLE not defined'
-
-if 'DEVELOPMENT' in GIMP:
- # development version
- GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
- for info in GIMP['DEVELOPMENT'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_DEVELOPMENT
- except NameError:
- RELEASE_DATE_DEVELOPMENT = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_DEVELOPMENT
- except NameError:
- WINDOWS_VER_DEVELOPMENT = version
- WINDOWS_FILE_DEVELOPMENT = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'md5'
- WINDOWS_HASH_DEVELOPMENT = info['windows'][0][WINDOWS_HASH_FUN_DEVELOPMENT]
- if 'macos' in info:
- try:
- MACOS_FILE_DEVELOPMENT
- except NameError:
- MACOS_VER_DEVELOPMENT = version
- MACOS_FILE_DEVELOPMENT = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'md5'
- MACOS_HASH_DEVELOPMENT = info['macos'][0][MACOS_HASH_FUN_DEVELOPMENT]
- if 'flatpak' in info:
- try:
- FLATPAK_FILE_DEVELOPMENT
- except NameError:
- FLATPAK_VER_DEVELOPMENT = version
- FLATPAK_FILE_DEVELOPMENT = {}
- FLATPAK_HASH_DEVELOPMENT = {}
- for arch, package in info['flatpak'].iteritems() :
- FLATPAK_FILE_DEVELOPMENT[arch] = package[0]['filename']
- FLATPAK_HASH_DEVELOPMENT[arch] = package[0]['md5']
-else:
- print 'DEVELOPMENT not defined'
-
-#
-# Random Header Background Image
-#
-# This is to get the possible header images
-# and choose one randomly to display.
-#
-# Templates will use HEADER_IMG data to parse image information.
-# Refer to the random_header plugin for actually putting the image
-# in the correct stylesheet.
-#
-from random import randint
-with open('header-images.json') as data:
- IMG_LIST = json.load(data)
-
-HEADER_IMG = IMG_LIST[ randint(0, len(IMG_LIST) - 1) ]
+# Import everything to the global scope.
+from pelicanconf_common import *
+customize_environment('local')
diff --git a/pelicanconf.py b/pelicanconf.py
index dcc04a5f..a38fa5f3 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -1,285 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
-from __future__ import unicode_literals
-#Plugins
-PLUGIN_PATHS = ["plugins"]
-#PLUGINS = ["page_hierarchy_gimp"]
-PLUGINS = ["mimic_hierarchy", "i18n_subsites", "sitemap", "gimp_mirrors", "tipue_search", "random_header"]
-
-# sitemap plugin settings
-SITEMAP = {
- 'format': 'xml',
- 'priorities': {
- 'articles': 1,
- 'indexes': 0.5,
- 'pages': 1
- },
- 'changefreqs': {
- 'articles': 'weekly',
- 'indexes': 'weekly',
- 'pages': 'weekly'
- }
-}
-
-# mapping: language_code -> settings_overrides_dict
-I18N_SUBSITES = {
- 'fr': {
- 'SITENAME': 'GIMP FR',
- },
- 'ar': {
- 'SITENAME': 'GIMP AR',
- },
- }
-
-AUTHOR = u'Pat David'
-SITENAME = u'GIMP'
-SITEURL = 'https://www.gimp.org'
-SITEMAP_SITEURL = 'https://www.gimp.org'
-#GIMP_VERSION = u'2.8.20'
-
-PATH = 'content'
-
-TIMEZONE = 'Europe/Paris'
-DEFAULT_LANG = u'en'
-DEFAULT_DATE_FORMAT = "%Y-%m-%d"
-
-# Allow dating news posts in the future
-# before then, they will automatically have
-# Status: draft set
-WITH_FUTURE_DATES = False
-
-# Feed generation is usually not desired when developing
-FEED_DOMAIN = SITEURL
-FEED_ATOM = 'feeds/atom.xml'
-FEED_RSS = 'feeds/rss.xml'
-FEED_ALL_ATOM = 'feeds/all.atom.xml'
-CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
-TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml'
-TRANSLATION_FEED_RSS = 'feeds/all-%s.rss.xml'
-AUTHOR_FEED_ATOM = None
-AUTHOR_FEED_RSS = None
-
-# # Blogroll
-# LINKS = (('Pelican', 'http://getpelican.com/'),
-# ('Python.org', 'http://python.org/'),
-# ('Jinja2', 'http://jinja.pocoo.org/'),
-# ('You can modify those links in your config file', '#'),)
-#
-# # Social widget
-# SOCIAL = (('You can add links in your config file', '#'),
-# ('Another social link', '#'),)
-
-DEFAULT_PAGINATION = False
-
-
-
-# Pat David changes while building/testing
-READERS = {'html': None}
-
-# This will copy over these folders w/o modification
-STATIC_PATHS = ['images', 'js', 'pages', 'tutorials', 'about', 'books', 'develop', 'docs', 'donating',
'downloads', 'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix',
'robots.txt', 'COPYING', 'GNUGPLv2', 'GNUGPLv3', 'news', 'contribute.json', 'gimp_versions.json']
-
-# This sets which directories will be parsed as pages (vs. news/articles)
-# If a new directory is to be added under content/, make sure it gets added here.
-PAGE_PATHS = ['about', 'frontpage', 'tutorials', 'books', 'develop', 'docs', 'donating', 'downloads',
'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix', 'search.md', 'registry']
-
-ARTICLE_PATHS = ['news']
-
-THEME = "./themes/newgimp"
-
-PAGE_URL = "{slug}/"
-#PAGE_SAVE_AS = "{slug}/index.html"
-PAGE_SAVE_AS = "{slug}/{filename}"
-
-ARTICLE_URL = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/"
-ARTICLE_SAVE_AS = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"
-
-# This redirects the old standard output of blog/news/articles post
-# summaries on the front page. It will now appear at the location
-# below instead.
-# The _actual_ index.html page is located at:
-# content/pages/index.md -> which simply calls the home.html template
-# See: http://docs.getpelican.com/en/3.6.3/faq.html#how-can-i-use-a-static-page-as-my-home-page
-# This sets the "old" index.html page to be saved to /news/index.html.
-INDEX_SAVE_AS = "/news/index.html"
-
-
-TYPOGRIFY = True
-TYPOGRIFY_IGNORE_TAGS = ['title']
-
-DELETE_OUTPUT_DIRECTORY = True
-
-MD_EXTENSIONS = ['fenced_code', 'codehilite(css_class=codehilite)', 'extra', 'headerid',
'toc(permalink=True)']
-
-# Pagination testing stuff
-
-DEFAULT_ORPHANS = 0
-DEFAULT_PAGINATION = 10
-
-# Debug output on pages
-# Seting to 'True' will show child/parent pages at bottom of pages
-PAGES_DEBUG = False
-
-# When developing, you probably want document relative URLs - so set this to True
-# When publishing, set to False
-RELATIVE_URLS = False
-
-###########################################################
-# Functions below for pushing data to the build system
-###########################################################
-
-#
-# 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('content/gimp_versions.json') 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.
- GIMP_VERSION = GIMP['STABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
- for info in GIMP['STABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE
- except NameError:
- RELEASE_DATE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE
- except NameError:
- WINDOWS_VER = version
- WINDOWS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'md5'
- WINDOWS_HASH = info['windows'][0][WINDOWS_HASH_FUN]
- if 'min-support' in info['windows'][0]:
- WINDOWS_MIN_SUPPORT = info['windows'][0]["min-support"]
- if 'macos' in info:
- try:
- MACOS_FILE
- except NameError:
- MACOS_VER = version
- MACOS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN = 'md5'
- MACOS_HASH = info['macos'][0][MACOS_HASH_FUN]
- if 'min-support' in info['macos'][0]:
- MACOS_MIN_SUPPORT = info['macos'][0]["min-support"]
-else:
- print 'STABLE not defined'
-
-if 'OLDSTABLE' in GIMP:
- # Set the current stable GIMP version from
- # the GIMP_VERSIONS json file. The most
- # current version _should_ be the first key.
- GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.',
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
- for info in GIMP['OLDSTABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_OLDSTABLE
- except NameError:
- RELEASE_DATE_OLDSTABLE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_OLDSTABLE
- except NameError:
- WINDOWS_VER_OLDSTABLE = version
- WINDOWS_MAJOR_MINOR_VER_OLDSTABLE = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE_OLDSTABLE = info['windows'][0]['filename']
- WINDOWS_HASH_OLDSTABLE = info['windows'][0]['md5']
- if 'macos' in info:
- try:
- MACOS_FILE_OLDSTABLE
- except NameError:
- MACOS_VER_OLDSTABLE = version
- MACOS_MAJOR_MINOR_VER_OLDSTABLE= version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE_OLDSTABLE = info['macos'][0]['filename']
- MACOS_HASH_OLDSTABLE = info['macos'][0]['md5']
-else:
- print 'OLDSTABLE not defined'
-
-if 'DEVELOPMENT' in GIMP:
- # development version
- GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
- for info in GIMP['DEVELOPMENT'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_DEVELOPMENT
- except NameError:
- RELEASE_DATE_DEVELOPMENT = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_DEVELOPMENT
- except NameError:
- WINDOWS_VER_DEVELOPMENT = version
- WINDOWS_FILE_DEVELOPMENT = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'md5'
- WINDOWS_HASH_DEVELOPMENT = info['windows'][0][WINDOWS_HASH_FUN_DEVELOPMENT]
- if 'macos' in info:
- try:
- MACOS_FILE_DEVELOPMENT
- except NameError:
- MACOS_VER_DEVELOPMENT = version
- MACOS_FILE_DEVELOPMENT = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'md5'
- MACOS_HASH_DEVELOPMENT = info['macos'][0][MACOS_HASH_FUN_DEVELOPMENT]
- if 'flatpak' in info:
- try:
- FLATPAK_FILE_DEVELOPMENT
- except NameError:
- FLATPAK_VER_DEVELOPMENT = version
- FLATPAK_FILE_DEVELOPMENT = {}
- FLATPAK_HASH_DEVELOPMENT = {}
- for arch, package in info['flatpak'].iteritems() :
- FLATPAK_FILE_DEVELOPMENT[arch] = package[0]['filename']
- FLATPAK_HASH_DEVELOPMENT[arch] = package[0]['md5']
-else:
- print 'DEVELOPMENT not defined'
-
-#
-# Random Header Background Image
-#
-# This is to get the possible header images
-# and choose one randomly to display.
-#
-# Templates will use HEADER_IMG data to parse image information.
-# Refer to the random_header plugin for actually putting the image
-# in the correct stylesheet.
-#
-from random import randint
-with open('header-images.json') as data:
- IMG_LIST = json.load(data)
-
-HEADER_IMG = IMG_LIST[ randint(0, len(IMG_LIST) - 1) ]
+# Import everything to the global scope.
+from pelicanconf_common import *
+customize_environment('production')
diff --git a/pelicanconf.testing.py b/pelicanconf.testing.py
index 1f091bbc..3e5b51b0 100644
--- a/pelicanconf.testing.py
+++ b/pelicanconf.testing.py
@@ -1,285 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
-from __future__ import unicode_literals
-#Plugins
-PLUGIN_PATHS = ["plugins"]
-#PLUGINS = ["page_hierarchy_gimp"]
-PLUGINS = ["mimic_hierarchy", "i18n_subsites", "sitemap", "gimp_mirrors", "tipue_search", "random_header"]
-
-# sitemap plugin settings
-SITEMAP = {
- 'format': 'xml',
- 'priorities': {
- 'articles': 1,
- 'indexes': 0.5,
- 'pages': 1
- },
- 'changefreqs': {
- 'articles': 'weekly',
- 'indexes': 'weekly',
- 'pages': 'weekly'
- }
-}
-
-# mapping: language_code -> settings_overrides_dict
-I18N_SUBSITES = {
- 'fr': {
- 'SITENAME': 'GIMP FR',
- },
- 'ar': {
- 'SITENAME': 'GIMP AR',
- },
- }
-
-AUTHOR = u'Pat David'
-SITENAME = u'GIMP'
-SITEURL = 'https://testing.gimp.org'
-SITEMAP_SITEURL = 'https://testing.gimp.org'
-#GIMP_VERSION = u'2.8.20'
-
-PATH = 'content'
-
-TIMEZONE = 'Europe/Paris'
-DEFAULT_LANG = u'en'
-DEFAULT_DATE_FORMAT = "%Y-%m-%d"
-
-# Allow dating news posts in the future
-# before then, they will automatically have
-# Status: draft set
-WITH_FUTURE_DATES = False
-
-# Feed generation is usually not desired when developing
-FEED_DOMAIN = SITEURL
-FEED_ATOM = 'feeds/atom.xml'
-FEED_RSS = 'feeds/rss.xml'
-FEED_ALL_ATOM = 'feeds/all.atom.xml'
-CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
-TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml'
-TRANSLATION_FEED_RSS = 'feeds/all-%s.rss.xml'
-AUTHOR_FEED_ATOM = None
-AUTHOR_FEED_RSS = None
-
-# # Blogroll
-# LINKS = (('Pelican', 'http://getpelican.com/'),
-# ('Python.org', 'http://python.org/'),
-# ('Jinja2', 'http://jinja.pocoo.org/'),
-# ('You can modify those links in your config file', '#'),)
-#
-# # Social widget
-# SOCIAL = (('You can add links in your config file', '#'),
-# ('Another social link', '#'),)
-
-DEFAULT_PAGINATION = False
-
-
-
-# Pat David changes while building/testing
-READERS = {'html': None}
-
-# This will copy over these folders w/o modification
-STATIC_PATHS = ['images', 'js', 'pages', 'tutorials', 'about', 'books', 'develop', 'docs', 'donating',
'downloads', 'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix',
'robots.txt', 'COPYING', 'GNUGPLv2', 'GNUGPLv3', 'news', 'contribute.json', '.htaccess', 'gimp_versions.json']
-
-# This sets which directories will be parsed as pages (vs. news/articles)
-# If a new directory is to be added under content/, make sure it gets added here.
-PAGE_PATHS = ['about', 'frontpage', 'tutorials', 'books', 'develop', 'docs', 'donating', 'downloads',
'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix', 'search.md', 'registry']
-
-ARTICLE_PATHS = ['news']
-
-THEME = "./themes/newgimp"
-
-PAGE_URL = "{slug}/"
-#PAGE_SAVE_AS = "{slug}/index.html"
-PAGE_SAVE_AS = "{slug}/{filename}"
-
-ARTICLE_URL = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/"
-ARTICLE_SAVE_AS = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"
-
-# This redirects the old standard output of blog/news/articles post
-# summaries on the front page. It will now appear at the location
-# below instead.
-# The _actual_ index.html page is located at:
-# content/pages/index.md -> which simply calls the home.html template
-# See: http://docs.getpelican.com/en/3.6.3/faq.html#how-can-i-use-a-static-page-as-my-home-page
-# This sets the "old" index.html page to be saved to /news/index.html.
-INDEX_SAVE_AS = "/news/index.html"
-
-
-TYPOGRIFY = True
-TYPOGRIFY_IGNORE_TAGS = ['title']
-
-DELETE_OUTPUT_DIRECTORY = True
-
-MD_EXTENSIONS = ['fenced_code', 'codehilite(css_class=codehilite)', 'extra', 'headerid',
'toc(permalink=True)']
-
-# Pagination testing stuff
-
-DEFAULT_ORPHANS = 0
-DEFAULT_PAGINATION = 10
-
-# Debug output on pages
-# Seting to 'True' will show child/parent pages at bottom of pages
-PAGES_DEBUG = False
-
-# When developing, you probably want document relative URLs - so set this to True
-# When publishing, set to False
-RELATIVE_URLS = True
-
-###########################################################
-# Functions below for pushing data to the build system
-###########################################################
-
-#
-# 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('content/gimp_versions.json') 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.
- GIMP_VERSION = GIMP['STABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
- for info in GIMP['STABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE
- except NameError:
- RELEASE_DATE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE
- except NameError:
- WINDOWS_VER = version
- WINDOWS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN = 'md5'
- WINDOWS_HASH = info['windows'][0][WINDOWS_HASH_FUN]
- if 'min-support' in info['windows'][0]:
- WINDOWS_MIN_SUPPORT = info['windows'][0]["min-support"]
- if 'macos' in info:
- try:
- MACOS_FILE
- except NameError:
- MACOS_VER = version
- MACOS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN = 'md5'
- MACOS_HASH = info['macos'][0][MACOS_HASH_FUN]
- if 'min-support' in info['macos'][0]:
- MACOS_MIN_SUPPORT = info['macos'][0]["min-support"]
-else:
- print 'STABLE not defined'
-
-if 'OLDSTABLE' in GIMP:
- # Set the current stable GIMP version from
- # the GIMP_VERSIONS json file. The most
- # current version _should_ be the first key.
- GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
- GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.',
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
- for info in GIMP['OLDSTABLE'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_OLDSTABLE
- except NameError:
- RELEASE_DATE_OLDSTABLE = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_OLDSTABLE
- except NameError:
- WINDOWS_VER_OLDSTABLE = version
- WINDOWS_MAJOR_MINOR_VER_OLDSTABLE = version[:version.index('.', version.index('.') + 1)]
- WINDOWS_FILE_OLDSTABLE = info['windows'][0]['filename']
- WINDOWS_HASH_OLDSTABLE = info['windows'][0]['md5']
- if 'macos' in info:
- try:
- MACOS_FILE_OLDSTABLE
- except NameError:
- MACOS_VER_OLDSTABLE = version
- MACOS_MAJOR_MINOR_VER_OLDSTABLE= version[:version.index('.', version.index('.') + 1)]
- MACOS_FILE_OLDSTABLE = info['macos'][0]['filename']
- MACOS_HASH_OLDSTABLE = info['macos'][0]['md5']
-else:
- print 'OLDSTABLE not defined'
-
-if 'DEVELOPMENT' in GIMP:
- # development version
- GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
- for info in GIMP['DEVELOPMENT'] :
- version = info['version']
- if 'date' in info:
- try:
- RELEASE_DATE_DEVELOPMENT
- except NameError:
- RELEASE_DATE_DEVELOPMENT = info['date']
- if 'windows' in info:
- try:
- WINDOWS_FILE_DEVELOPMENT
- except NameError:
- WINDOWS_VER_DEVELOPMENT = version
- WINDOWS_FILE_DEVELOPMENT = info['windows'][0]['filename']
- if 'sha256' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['windows'][0]:
- WINDOWS_HASH_FUN_DEVELOPMENT = 'md5'
- WINDOWS_HASH_DEVELOPMENT = info['windows'][0][WINDOWS_HASH_FUN_DEVELOPMENT]
- if 'macos' in info:
- try:
- MACOS_FILE_DEVELOPMENT
- except NameError:
- MACOS_VER_DEVELOPMENT = version
- MACOS_FILE_DEVELOPMENT = info['macos'][0]['filename']
- if 'sha256' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha256'
- elif 'sha512' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'sha512'
- elif 'md5' in info['macos'][0]:
- MACOS_HASH_FUN_DEVELOPMENT = 'md5'
- MACOS_HASH_DEVELOPMENT = info['macos'][0][MACOS_HASH_FUN_DEVELOPMENT]
- if 'flatpak' in info:
- try:
- FLATPAK_FILE_DEVELOPMENT
- except NameError:
- FLATPAK_VER_DEVELOPMENT = version
- FLATPAK_FILE_DEVELOPMENT = {}
- FLATPAK_HASH_DEVELOPMENT = {}
- for arch, package in info['flatpak'].iteritems() :
- FLATPAK_FILE_DEVELOPMENT[arch] = package[0]['filename']
- FLATPAK_HASH_DEVELOPMENT[arch] = package[0]['md5']
-else:
- print 'DEVELOPMENT not defined'
-
-#
-# Random Header Background Image
-#
-# This is to get the possible header images
-# and choose one randomly to display.
-#
-# Templates will use HEADER_IMG data to parse image information.
-# Refer to the random_header plugin for actually putting the image
-# in the correct stylesheet.
-#
-from random import randint
-with open('header-images.json') as data:
- IMG_LIST = json.load(data)
-
-HEADER_IMG = IMG_LIST[ randint(0, len(IMG_LIST) - 1) ]
+# Import everything to the global scope.
+from pelicanconf_common import *
+customize_environment('testing')
diff --git a/pelicanconf_common.py b/pelicanconf_common.py
new file mode 100644
index 00000000..e8f235b6
--- /dev/null
+++ b/pelicanconf_common.py
@@ -0,0 +1,337 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*- #
+from __future__ import unicode_literals
+
+# These are default values which may be modified by
+# customize_environment().
+SITEURL = 'https://www.gimp.org'
+SITEMAP_SITEURL = 'https://www.gimp.org'
+
+LOAD_CONTENT_CACHE = False
+CHECK_MODIFIED_METHOD = 'mtime'
+CACHE_CONTENT = False
+
+FEED_DOMAIN = None
+FEED_ATOM = None
+FEED_RSS = None
+FEED_ALL_ATOM = 'feeds/all.atom.xml'
+CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
+TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml'
+TRANSLATION_FEED_RSS = 'feeds/all-%s.rss.xml'
+AUTHOR_FEED_ATOM = None
+AUTHOR_FEED_RSS = None
+
+DELETE_OUTPUT_DIRECTORY = False
+RELATIVE_URLS = False
+
+# This will copy over these folders w/o modification
+STATIC_PATHS = ['images', 'js', 'pages', 'tutorials', 'about', 'books', 'develop', 'docs', 'donating',
'downloads', 'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix',
'robots.txt', 'COPYING', 'GNUGPLv2', 'GNUGPLv3', 'news', 'contribute.json', '.htaccess', 'gimp_versions.json']
+
+def customize_environment(environment):
+ global SITEURL, SITEMAP_SITEURL
+ global LOAD_CONTENT_CACHE, CHECK_MODIFIED_METHOD, CACHE_CONTENT
+ global FEED_DOMAIN, FEED_ATOM, FEED_RSS
+ global DELETE_OUTPUT_DIRECTORY
+ global RELATIVE_URLS
+ global STATIC_PATHS
+
+ valid_environments = [ 'local', 'testing', 'production' ]
+ if environment not in valid_environments:
+ print("customize_environment() must be called with one of: {}".format(', '.join(valid_environments)))
+ exit(1)
+
+ if environment == 'testing':
+ SITEURL = 'https://testing.gimp.org'
+ SITEMAP_SITEURL = 'https://testing.gimp.org'
+ else:
+ SITEURL = 'https://www.gimp.org'
+ SITEMAP_SITEURL = 'https://www.gimp.org'
+
+ if environment == 'local':
+ #
+ # Caching build for faster regeneration
+ #
+ LOAD_CONTENT_CACHE = True
+ CHECK_MODIFIED_METHOD = 'mtime'
+ CACHE_CONTENT = True
+ else:
+ # Feed generation is usually not desired when developing
+ FEED_DOMAIN = SITEURL
+ FEED_ATOM = 'feeds/atom.xml'
+ FEED_RSS = 'feeds/rss.xml'
+
+ DELETE_OUTPUT_DIRECTORY = True
+
+ # When developing, you probably want document relative URLs - so set this to True
+ # When publishing, set to False
+ RELATIVE_URLS = False if environment == 'production' else True
+
+ if environment != 'production':
+ # Not sure why, but production pelicanconf didn't have .htaccess
+ # in the list. Was it an error?
+ STATIC_PATHS += ['.htaccess']
+
+#######################################
+## Values common to all environments ##
+#######################################
+
+#Plugins
+PLUGIN_PATHS = ["plugins"]
+#PLUGINS = ["page_hierarchy_gimp"]
+PLUGINS = ["mimic_hierarchy", "i18n_subsites", "sitemap", "gimp_mirrors", "tipue_search", "random_header"]
+
+# sitemap plugin settings
+SITEMAP = {
+ 'format': 'xml',
+ 'priorities': {
+ 'articles': 1,
+ 'indexes': 0.5,
+ 'pages': 1
+ },
+ 'changefreqs': {
+ 'articles': 'weekly',
+ 'indexes': 'weekly',
+ 'pages': 'weekly'
+ }
+}
+
+# mapping: language_code -> settings_overrides_dict
+I18N_SUBSITES = {
+ 'fr': {
+ 'SITENAME': 'GIMP FR',
+ },
+ 'ar': {
+ 'SITENAME': 'GIMP AR',
+ },
+ }
+
+AUTHOR = u'Pat David'
+SITENAME = u'GIMP'
+
+#GIMP_VERSION = u'2.8.20'
+
+PATH = 'content'
+
+TIMEZONE = 'Europe/Paris'
+DEFAULT_LANG = u'en'
+DEFAULT_DATE_FORMAT = "%Y-%m-%d"
+
+# Allow dating news posts in the future
+# before then, they will automatically have
+# Status: draft set
+WITH_FUTURE_DATES = False
+
+# # Blogroll
+# LINKS = (('Pelican', 'http://getpelican.com/'),
+# ('Python.org', 'http://python.org/'),
+# ('Jinja2', 'http://jinja.pocoo.org/'),
+# ('You can modify those links in your config file', '#'),)
+#
+# # Social widget
+# SOCIAL = (('You can add links in your config file', '#'),
+# ('Another social link', '#'),)
+
+DEFAULT_PAGINATION = False
+
+
+
+# Pat David changes while building/testing
+READERS = {'html': None}
+
+# This sets which directories will be parsed as pages (vs. news/articles)
+# If a new directory is to be added under content/, make sure it gets added here.
+PAGE_PATHS = ['about', 'frontpage', 'tutorials', 'books', 'develop', 'docs', 'donating', 'downloads',
'features', 'bugs', 'links', 'man', 'release-notes', 'screenshots', 'source', 'unix', 'search.md', 'registry']
+
+ARTICLE_PATHS = ['news']
+
+THEME = "./themes/newgimp"
+
+PAGE_URL = "{slug}/"
+#PAGE_SAVE_AS = "{slug}/index.html"
+PAGE_SAVE_AS = "{slug}/{filename}"
+
+ARTICLE_URL = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/"
+ARTICLE_SAVE_AS = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"
+
+# This redirects the old standard output of blog/news/articles post
+# summaries on the front page. It will now appear at the location
+# below instead.
+# The _actual_ index.html page is located at:
+# content/pages/index.md -> which simply calls the home.html template
+# See: http://docs.getpelican.com/en/3.6.3/faq.html#how-can-i-use-a-static-page-as-my-home-page
+# This sets the "old" index.html page to be saved to /news/index.html.
+INDEX_SAVE_AS = "/news/index.html"
+
+
+TYPOGRIFY = True
+TYPOGRIFY_IGNORE_TAGS = ['title']
+
+MD_EXTENSIONS = ['fenced_code', 'codehilite(css_class=codehilite)', 'extra', 'headerid',
'toc(permalink=True)']
+
+# Pagination testing stuff
+
+DEFAULT_ORPHANS = 0
+DEFAULT_PAGINATION = 10
+
+# Debug output on pages
+# Seting to 'True' will show child/parent pages at bottom of pages
+PAGES_DEBUG = False
+
+###########################################################
+# Functions below for pushing data to the build system
+###########################################################
+
+#
+# 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('content/gimp_versions.json') 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.
+ GIMP_VERSION = GIMP['STABLE'][0]['version']
+ GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
+ for info in GIMP['STABLE'] :
+ version = info['version']
+ if 'date' in info:
+ try:
+ RELEASE_DATE
+ except NameError:
+ RELEASE_DATE = info['date']
+ if 'windows' in info:
+ try:
+ WINDOWS_FILE
+ except NameError:
+ WINDOWS_VER = version
+ WINDOWS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
+ WINDOWS_FILE = info['windows'][0]['filename']
+ if 'sha256' in info['windows'][0]:
+ WINDOWS_HASH_FUN = 'sha256'
+ elif 'sha512' in info['windows'][0]:
+ WINDOWS_HASH_FUN = 'sha512'
+ elif 'md5' in info['windows'][0]:
+ WINDOWS_HASH_FUN = 'md5'
+ WINDOWS_HASH = info['windows'][0][WINDOWS_HASH_FUN]
+ if 'min-support' in info['windows'][0]:
+ WINDOWS_MIN_SUPPORT = info['windows'][0]["min-support"]
+ if 'macos' in info:
+ try:
+ MACOS_FILE
+ except NameError:
+ MACOS_VER = version
+ MACOS_MAJOR_MINOR_VER = version[:version.index('.', version.index('.') + 1)]
+ MACOS_FILE = info['macos'][0]['filename']
+ if 'sha256' in info['macos'][0]:
+ MACOS_HASH_FUN = 'sha256'
+ elif 'sha512' in info['macos'][0]:
+ MACOS_HASH_FUN = 'sha512'
+ elif 'md5' in info['macos'][0]:
+ MACOS_HASH_FUN = 'md5'
+ MACOS_HASH = info['macos'][0][MACOS_HASH_FUN]
+ if 'min-support' in info['macos'][0]:
+ MACOS_MIN_SUPPORT = info['macos'][0]["min-support"]
+else:
+ print 'STABLE not defined'
+
+if 'OLDSTABLE' in GIMP:
+ # Set the current stable GIMP version from
+ # the GIMP_VERSIONS json file. The most
+ # current version _should_ be the first key.
+ GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
+ GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.',
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
+ for info in GIMP['OLDSTABLE'] :
+ version = info['version']
+ if 'date' in info:
+ try:
+ RELEASE_DATE_OLDSTABLE
+ except NameError:
+ RELEASE_DATE_OLDSTABLE = info['date']
+ if 'windows' in info:
+ try:
+ WINDOWS_FILE_OLDSTABLE
+ except NameError:
+ WINDOWS_VER_OLDSTABLE = version
+ WINDOWS_MAJOR_MINOR_VER_OLDSTABLE = version[:version.index('.', version.index('.') + 1)]
+ WINDOWS_FILE_OLDSTABLE = info['windows'][0]['filename']
+ WINDOWS_HASH_OLDSTABLE = info['windows'][0]['md5']
+ if 'macos' in info:
+ try:
+ MACOS_FILE_OLDSTABLE
+ except NameError:
+ MACOS_VER_OLDSTABLE = version
+ MACOS_MAJOR_MINOR_VER_OLDSTABLE= version[:version.index('.', version.index('.') + 1)]
+ MACOS_FILE_OLDSTABLE = info['macos'][0]['filename']
+ MACOS_HASH_OLDSTABLE = info['macos'][0]['md5']
+else:
+ print 'OLDSTABLE not defined'
+
+if 'DEVELOPMENT' in GIMP:
+ # development version
+ GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
+ for info in GIMP['DEVELOPMENT'] :
+ version = info['version']
+ if 'date' in info:
+ try:
+ RELEASE_DATE_DEVELOPMENT
+ except NameError:
+ RELEASE_DATE_DEVELOPMENT = info['date']
+ if 'windows' in info:
+ try:
+ WINDOWS_FILE_DEVELOPMENT
+ except NameError:
+ WINDOWS_VER_DEVELOPMENT = version
+ WINDOWS_FILE_DEVELOPMENT = info['windows'][0]['filename']
+ if 'sha256' in info['windows'][0]:
+ WINDOWS_HASH_FUN_DEVELOPMENT = 'sha256'
+ elif 'sha512' in info['windows'][0]:
+ WINDOWS_HASH_FUN_DEVELOPMENT = 'sha512'
+ elif 'md5' in info['windows'][0]:
+ WINDOWS_HASH_FUN_DEVELOPMENT = 'md5'
+ WINDOWS_HASH_DEVELOPMENT = info['windows'][0][WINDOWS_HASH_FUN_DEVELOPMENT]
+ if 'macos' in info:
+ try:
+ MACOS_FILE_DEVELOPMENT
+ except NameError:
+ MACOS_VER_DEVELOPMENT = version
+ MACOS_FILE_DEVELOPMENT = info['macos'][0]['filename']
+ if 'sha256' in info['macos'][0]:
+ MACOS_HASH_FUN_DEVELOPMENT = 'sha256'
+ elif 'sha512' in info['macos'][0]:
+ MACOS_HASH_FUN_DEVELOPMENT = 'sha512'
+ elif 'md5' in info['macos'][0]:
+ MACOS_HASH_FUN_DEVELOPMENT = 'md5'
+ MACOS_HASH_DEVELOPMENT = info['macos'][0][MACOS_HASH_FUN_DEVELOPMENT]
+ if 'flatpak' in info:
+ try:
+ FLATPAK_FILE_DEVELOPMENT
+ except NameError:
+ FLATPAK_VER_DEVELOPMENT = version
+ FLATPAK_FILE_DEVELOPMENT = {}
+ FLATPAK_HASH_DEVELOPMENT = {}
+ for arch, package in info['flatpak'].iteritems() :
+ FLATPAK_FILE_DEVELOPMENT[arch] = package[0]['filename']
+ FLATPAK_HASH_DEVELOPMENT[arch] = package[0]['md5']
+else:
+ print 'DEVELOPMENT not defined'
+
+#
+# Random Header Background Image
+#
+# This is to get the possible header images
+# and choose one randomly to display.
+#
+# Templates will use HEADER_IMG data to parse image information.
+# Refer to the random_header plugin for actually putting the image
+# in the correct stylesheet.
+#
+from random import randint
+with open('header-images.json') as data:
+ IMG_LIST = json.load(data)
+
+HEADER_IMG = IMG_LIST[ randint(0, len(IMG_LIST) - 1) ]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]