[gimp-web/testing] Fixing module import in pelicanconf* files
- From: Pat David <patdavid src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-web/testing] Fixing module import in pelicanconf* files
- Date: Mon, 17 Feb 2020 22:47:57 +0000 (UTC)
commit e4635358cfc94947b0269c5e709cb1e9c6705647
Author: Pat David <patdavid gmail com>
Date: Mon Feb 17 16:47:47 2020 -0600
Fixing module import in pelicanconf* files
content/news/draft-index.md | 1 -
pelicanconf.local.py | 3 +
pelicanconf.py | 3 +
pelicanconf.testing.py | 332 +-------------------------------------------
pelicanconf.testing.py.orig | 6 -
5 files changed, 10 insertions(+), 335 deletions(-)
---
diff --git a/content/news/draft-index.md b/content/news/draft-index.md
index 0e5cdc6f..f226d2c3 100644
--- a/content/news/draft-index.md
+++ b/content/news/draft-index.md
@@ -7,7 +7,6 @@ template: draft-index
slug: index
This file is only a placeholder, so we can have an index of current draft articles being written.
-This does not currently work on local installs for some reason - this is being investigated.
If you're on testing.gimp.org or www.gimp.org you should see any drafts here.
Files with the metadata attribute *Status* set to *draft* (`Status: draft`) should show here.
diff --git a/pelicanconf.local.py b/pelicanconf.local.py
index 47616ed0..127f2287 100644
--- a/pelicanconf.local.py
+++ b/pelicanconf.local.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
+import sys
+sys.path.append('.')
+
# Import everything to the global scope.
from pelicanconf_common import *
customize_environment('local')
diff --git a/pelicanconf.py b/pelicanconf.py
index a38fa5f3..8eb62a58 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
+import sys
+sys.path.append('.')
+
# Import everything to the global scope.
from pelicanconf_common import *
customize_environment('production')
diff --git a/pelicanconf.testing.py b/pelicanconf.testing.py
index be6555e0..a8aedd73 100644
--- a/pelicanconf.testing.py
+++ b/pelicanconf.testing.py
@@ -1,333 +1,9 @@
#!/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
-
-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
-
- 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 = True if environment == 'local' else False
+import sys
+sys.path.append('.')
+# Import everything to the global scope.
+from pelicanconf_common import *
customize_environment('testing')
-
-#######################################
-## Values common to all environments ##
-#######################################
-
-# 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']
-
-#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]