[Blends-commit] [SCM] website branch, master, updated. 0ec1659526c78b76ae6ee0ab42714cc4ca882ebd
Ole Streicher
olebole at debian.org
Tue Mar 8 21:02:32 UTC 2016
The following commit has been merged in the master branch:
commit 0ec1659526c78b76ae6ee0ab42714cc4ca882ebd
Author: Ole Streicher <olebole at debian.org>
Date: Tue Mar 8 22:02:29 2016 +0100
Even more PEP8...
diff --git a/webtools/blendslanguages.py b/webtools/blendslanguages.py
index 4903897..a0ea90a 100644
--- a/webtools/blendslanguages.py
+++ b/webtools/blendslanguages.py
@@ -12,29 +12,30 @@ from genshi import Markup
# 'htaccess' = language definition in htaccess
# 'title' = English name of the language used in title attribut of link
# 'printed' = printed name for links
-language_dict = { 'en' : {'short':'en', 'htaccess':'en' , 'title':'English', 'printed':Markup('English')},
- 'cs' : {'short':'cs', 'htaccess':'cs' , 'title':'Czech', 'printed':Markup('česky')},
- 'da' : {'short':'da', 'htaccess':'da' , 'title':'Danish' , 'printed':Markup('dansk')},
- 'de' : {'short':'de', 'htaccess':'de' , 'title':'German', 'printed':Markup('Deutsch')},
- 'es' : {'short':'es', 'htaccess':'es' , 'title':'Spanish', 'printed':Markup('español')},
- 'fi' : {'short':'fi', 'htaccess':'fi' , 'title':'Finnish', 'printed':Markup('suomi')},
- 'fr' : {'short':'fr', 'htaccess':'fr' , 'title':'French', 'printed':Markup('français')},
- 'hu' : {'short':'hu', 'htaccess':'hu' , 'title':'Hungarian', 'printed':Markup('magyar')},
- 'it' : {'short':'it', 'htaccess':'it' , 'title':'Italian', 'printed':Markup('Italiano')},
- 'ja' : {'short':'ja', 'htaccess':'ja' , 'title':'Japanese', 'printed':Markup('日本語 (Nihongo)')},
- 'ko' : {'short':'ko', 'htaccess':'ko' , 'title':'Korean', 'printed':Markup('한국어 (Hangul)')},
- 'nl' : {'short':'nl', 'htaccess':'nl' , 'title':'Dutch', 'printed':Markup('Nederlands')},
- 'pl' : {'short':'pl', 'htaccess':'pl' , 'title':'Polish', 'printed':Markup('polski')},
- 'pt_BR' : {'short':'pt', 'htaccess':'pt-BR', 'title':'Portuguese', 'printed':Markup('Português')},
- 'ru' : {'short':'ru', 'htaccess':'ru' , 'title':'Russian', 'printed':Markup('Русский (Russkij)')},
- 'uk' : {'short':'uk', 'htaccess':'uk' , 'title':'Ukrainian', 'printed':Markup("українська (ukrajins'ka)")},
- 'sk' : {'short':'sk', 'htaccess':'sk' , 'title':'Slovenian', 'printed':Markup('slovensky')},
- 'sr' : {'short':'sr', 'htaccess':'sr' , 'title':'Serbian', 'printed':Markup('српски(srpski)')},
- 'sv' : {'short':'sv', 'htaccess':'sv' , 'title':'Swedish', 'printed':Markup('svenska')},
- 'vi' : {'short':'vi', 'htaccess':'vi' , 'title': 'Vietnamese', 'printed':Markup('Tiếng Việt')},
- 'zh_CN' : {'short':'zh_cn', 'htaccess':'zh-CN', 'title':'Chinese (China)', 'printed':Markup('中文(简)')},
- 'zh_TW' : {'short':'zh_tw', 'htaccess':'zh-TW', 'title':'Chinese (Taiwan)', 'printed':Markup('中文(正)')},
- }
+language_dict = {
+ 'en' : {'short':'en', 'htaccess':'en' , 'title':'English', 'printed':Markup('English')},
+ 'cs' : {'short':'cs', 'htaccess':'cs' , 'title':'Czech', 'printed':Markup('česky')},
+ 'da' : {'short':'da', 'htaccess':'da' , 'title':'Danish' , 'printed':Markup('dansk')},
+ 'de' : {'short':'de', 'htaccess':'de' , 'title':'German', 'printed':Markup('Deutsch')},
+ 'es' : {'short':'es', 'htaccess':'es' , 'title':'Spanish', 'printed':Markup('español')},
+ 'fi' : {'short':'fi', 'htaccess':'fi' , 'title':'Finnish', 'printed':Markup('suomi')},
+ 'fr' : {'short':'fr', 'htaccess':'fr' , 'title':'French', 'printed':Markup('français')},
+ 'hu' : {'short':'hu', 'htaccess':'hu' , 'title':'Hungarian', 'printed':Markup('magyar')},
+ 'it' : {'short':'it', 'htaccess':'it' , 'title':'Italian', 'printed':Markup('Italiano')},
+ 'ja' : {'short':'ja', 'htaccess':'ja' , 'title':'Japanese', 'printed':Markup('日本語 (Nihongo)')},
+ 'ko' : {'short':'ko', 'htaccess':'ko' , 'title':'Korean', 'printed':Markup('한국어 (Hangul)')},
+ 'nl' : {'short':'nl', 'htaccess':'nl' , 'title':'Dutch', 'printed':Markup('Nederlands')},
+ 'pl' : {'short':'pl', 'htaccess':'pl' , 'title':'Polish', 'printed':Markup('polski')},
+ 'pt_BR' : {'short':'pt', 'htaccess':'pt-BR', 'title':'Portuguese', 'printed':Markup('Português')},
+ 'ru' : {'short':'ru', 'htaccess':'ru' , 'title':'Russian', 'printed':Markup('Русский (Russkij)')},
+ 'uk' : {'short':'uk', 'htaccess':'uk' , 'title':'Ukrainian', 'printed':Markup("українська (ukrajins'ka)")},
+ 'sk' : {'short':'sk', 'htaccess':'sk' , 'title':'Slovenian', 'printed':Markup('slovensky')},
+ 'sr' : {'short':'sr', 'htaccess':'sr' , 'title':'Serbian', 'printed':Markup('српски(srpski)')},
+ 'sv' : {'short':'sv', 'htaccess':'sv' , 'title':'Swedish', 'printed':Markup('svenska')},
+ 'vi' : {'short':'vi', 'htaccess':'vi' , 'title': 'Vietnamese', 'printed':Markup('Tiếng Việt')},
+ 'zh_CN' : {'short':'zh_cn', 'htaccess':'zh-CN', 'title':'Chinese (China)', 'printed':Markup('中文(简)')},
+ 'zh_TW' : {'short':'zh_tw', 'htaccess':'zh-TW', 'title':'Chinese (Taiwan)', 'printed':Markup('中文(正)')},
+}
# global languages
_languages = language_dict.keys()
_languages.sort()
diff --git a/webtools/blendsmarkdown.py b/webtools/blendsmarkdown.py
index 6f10dbd..6cdca26 100644
--- a/webtools/blendsmarkdown.py
+++ b/webtools/blendsmarkdown.py
@@ -17,6 +17,7 @@ detect_code_start_re = re.compile("^\s")
detect_code_end_re = re.compile("^[^\s]")
detect_url_re = re.compile("[fh]t?tp://")
+
def PrepareMarkdownInput(lines):
ret = ''
inlist = 0
@@ -25,32 +26,36 @@ def PrepareMarkdownInput(lines):
# strip leading space from description as well as useless trailing
line = re.sub('^ ', '', line.rstrip())
- # a '^\.$' marks in descriptions a new paragraph, markdown uses an empty line here
+ # a '^\.$' marks in descriptions a new paragraph, markdown
+ # uses an empty line here
line = re.sub('^\.$', '', line)
- # In long descriptions 'o' and '.' are quite frequently used as bullet in lists which
- # is not recognised by markdown. So just turn '[.o]' into '*' to let markdown do
- # its work successfully.
+ # In long descriptions 'o' and '.' are quite frequently used
+ # as bullet in lists which is not recognised by markdown. So
+ # just turn '[.o]' into '*' to let markdown do its work
+ # successfully.
line = re.sub('^(\s*)[.o]\s+', '\\1* ', line)
- # To enable Markdown debugging and verbose output in remarks a 'o'/'.' is inserted
- # as '\o'/'\.' in remarks - the original is restored here:
+ # To enable Markdown debugging and verbose output in remarks a
+ # 'o'/'.' is inserted as '\o'/'\.' in remarks - the original
+ # is restored here:
line = re.sub('^(\s*)\\\\([.o]\s+)', '\\1\\2', line)
if detect_code_start_re.search(line):
- if incode == 0: # If a list or verbatim mode starts MarkDown needs an empty line
+ if incode == 0: # If a list or verbatim mode starts MarkDown needs an empty line
ret += "\n"
incode = 1
if detect_list_start_re.search(line):
inlist = 1
if incode == 1 and inlist == 0:
- ret += "\t" # Add a leading tab if in verbatim but not in list mode
- # If there is an empty line or a not indented line the list or verbatim text ends
- # It is important to check for empty lines because some descriptions would insert
- # more lines than needed in verbose mode (see for instance glam2)
- if ( detect_code_end_re.search(line) or line == '' ) and incode == 1:
- inlist = 0 # list ends if indentation stops
- incode = 0 # verbatim mode ends if indentation stops
+ ret += "\t" # Add a leading tab if in verbatim but not in list mode
+ # If there is an empty line or a not indented line the list or
+ # verbatim text ends It is important to check for empty lines
+ # because some descriptions would insert more lines than
+ # needed in verbose mode (see for instance glam2)
+ if (detect_code_end_re.search(line) or line == '') and incode == 1:
+ inlist = 0 # list ends if indentation stops
+ incode = 0 # verbatim mode ends if indentation stops
# Mask # at first character in line which would lead to
# MARKDOWN-CRITICAL: "We've got a problem header!"
# otherwise
@@ -63,6 +68,7 @@ def PrepareMarkdownInput(lines):
ret += line + "\n"
return ret
+
def render_longdesc(lines):
MarkDownInput = PrepareMarkdownInput(lines)
@@ -74,13 +80,14 @@ def render_longdesc(lines):
stderr.write("Unable to render the following prepared text:\n%s\n" %
MarkDownInput)
LongDesc = "Problems in rendering description using reST"
- else: # by default use Markdown
+ else: # by default use Markdown
LongDesc = markdown(MarkDownInput)
return LongDesc
+
def SplitDescription(description):
# Split first line of Description value as short description
-
+
lines = description.splitlines()
ShortDesc = lines[0].replace("&", "&").replace("<", "<").replace(">", ">")
@@ -88,11 +95,12 @@ def SplitDescription(description):
return (ShortDesc, LongDesc)
+
def MarkupString(string, pkg, elem, lang='en'):
# Genshi does not touch strings that are marked with "Markup()"
# This function does the actual Markup call for any string with error checking
- if string == None:
+ if string is None:
return None
try:
string = Markup(string)
diff --git a/webtools/ddpo_register.py b/webtools/ddpo_register.py
index 7dadd06..05f7025 100755
--- a/webtools/ddpo_register.py
+++ b/webtools/ddpo_register.py
@@ -15,9 +15,9 @@ if len(argv) <= 1:
tasks = Tasks(argv[1])
if tasks.data['pkglist'] == '':
- stderr.write("Config file webconf/%s.conf is lacking pkglist field.\n"
- % argv[1])
+ stderr.write("Config file webconf/%s.conf is lacking pkglist field.\n" % argv[1])
exit(-1)
+
tasks.GetAllDependencies(source=1)
packages = tasks.GetNamesOnlyDict(dependencystatus=['official_high', 'official_low',
'non-free', 'experimental'])
@@ -25,7 +25,7 @@ packages = tasks.GetNamesOnlyDict(dependencystatus=['official_high', 'official_l
print("user %s" % tasks.data['pkglist'])
for task in packages.keys():
for pkg in packages[task]:
- print("subscribe %s %s" % ( pkg, task ))
+ print("subscribe %s %s" % (pkg, task))
print("thanks")
diff --git a/webtools/new_upstream.py b/webtools/new_upstream.py
index dc040d4..1b1a080 100755
--- a/webtools/new_upstream.py
+++ b/webtools/new_upstream.py
@@ -22,7 +22,7 @@ packages = tasks.GetUpdatablePackages(dependencystatus=['official_high', 'offici
for task in packages.keys():
print("Updatable packages in Task %s" % task)
for pkg_v_o in packages[task]:
- printstring = "\t%s:\n\t\tHighest version in Debian is %s\n\t\tUpstream has %s\n\t\tMaintainer is %s" % ( pkg_v_o[0] )
+ printstring = "\t%s:\n\t\tHighest version in Debian is %s\n\t\tUpstream has %s\n\t\tMaintainer is %s" % (pkg_v_o[0])
if pkg_v_o[1]:
printstring = printstring + "\n\t\tLast uploader was " + pkg_v_o[1]
try:
@@ -38,7 +38,7 @@ for task in packages.keys():
# breaks print for some reason I do not understand because everything should be UTF-8
# error is: 'ascii' codec can't encode character u'\xfc' in position 104: ordinal not in range(128)
# just stick to the e-mail address to do something useful ...
- print_wo_maintainer = pkg_v_o[0][3][0] # re.sub('^.+(<.+ at .+>.*)', '\\1', pkg_v_o[0][3])
+ print_wo_maintainer = pkg_v_o[0][3][0] # re.sub('^.+(<.+ at .+>.*)', '\\1', pkg_v_o[0][3])
print("\t\tMaintainer is ... %s\n" % print_wo_maintainer)
# print print_wo_maintainer[0:80]
if pkg_v_o[1]:
diff --git a/webtools/tasks.py b/webtools/tasks.py
index 50e5238..c0eb244 100755
--- a/webtools/tasks.py
+++ b/webtools/tasks.py
@@ -23,7 +23,7 @@ from blendstasktools import Tasks, GetDependencies2Use, pkgstatus, pkgstatus_sor
from blendslanguages import languages, language_dict
if len(argv) <= 1:
- stderr.write("Usage: %s <Blend name>\n"+
+ stderr.write("Usage: %s <Blend name>\n" +
" The <Blend name> needs a matching config file webconf/<Blend name>.conf\n"
% argv[0])
exit(-1)
@@ -104,8 +104,8 @@ for lang in languages:
data['discovery'] = Markup(_(
"""If you discover a project which looks like a good candidate for %s
to you, or if you have prepared an unofficial Debian package, please do not hesitate to
- send a description of that project to the <a href="mailto:%s">%s mailing list</a>""") %
- (data['projectname'], data['projectlist'], data['projectname']))
+ send a description of that project to the <a href="mailto:%s">%s mailing list</a>""")
+ % (data['projectname'], data['projectlist'], data['projectname']))
data['bugs'] = _('Bugs')
data['thermometer'] = _('Thermometer')
data['maintstats'] = _('Maintainer Stats')
@@ -251,7 +251,7 @@ for lang in languages:
with codecs.open(outputfile, "w", "utf-8") as f:
for l in template.generate(**data).render('xhtml').split('\n'):
if detect_ampersand_code_re.search(l):
- l = l.replace('%26', '&')
+ l = l.replace('%26', '&')
f.write(l + '\n')
SetFilePermissions(outputfile)
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list