[Blends-commit] [SCM] website branch, master, updated. 9e167386b8c68437a9b046378f5e20062292f8ed
Andreas Tille
tille at debian.org
Wed Jul 10 09:05:18 UTC 2013
The following commit has been merged in the master branch:
commit 3702f47293e39bde629512c326aa0bfa27e84029
Author: Andreas Tille <tille at debian.org>
Date: Mon Jul 8 20:21:56 2013 +0200
Use common way to create outputdir
diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index a493354..e49fb20 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -551,6 +551,20 @@ def ReadConfig(blendname=''):
return ret
+def CheckOrCreateOutputDir(maindir, subdir):
+ outputdir = maindir + '/' + subdir
+ if not os.access(outputdir, os.W_OK):
+ try:
+ os.mkdir(outputdir)
+ except:
+ # if more than one dir in the tree has to be crated just use mkdir -p ...
+ try:
+ os.system("mkdir -p %s" % outputdir)
+ except:
+ logger.error("Unable to create output dir " + outputdir)
+ return None
+ return outputdir
+
def FetchTasksFiles(data):
# Fetch tasks files from SVN of a Blend
# The specification of the repository containing the tasks files
@@ -1035,20 +1049,6 @@ class Tasks:
tdeps = self.tasks[task]
tdeps.MarkupPreformatedStrings()
- def CheckOrCreateOutputDir(self, subdir):
- outputdir = self.data['outputdir'] + '/' + subdir
- if not os.access(outputdir, os.W_OK):
- try:
- os.mkdir(outputdir)
- except:
- # if more than one dir in the tree has to be crated just use mkdir -p ...
- try:
- os.system("mkdir -p %s" % outputdir)
- except:
- logger.error("Unable to create output dir " + outputdir)
- return None
- return outputdir
-
def LinkEnhances(self):
# To provide a connection between packages enhancing other packages a set of links
# will be provided. The links should point to paragraphs on the tasks pages if the
diff --git a/webtools/bugs.py b/webtools/bugs.py
index e512167..f322086 100755
--- a/webtools/bugs.py
+++ b/webtools/bugs.py
@@ -13,6 +13,7 @@ from genshi import Markup
from blendstasktoolsold import Tasks, ReadConfig, PackageBugsOpenAndDone, \
DEPENDENT, SUGGESTED, DONE, BUGLISTCAT, SEVERITIES, HOMEPAGENONE
+from blendstasktools import CheckOrCreateOutputDir
if len(argv) <= 1:
print >>stderr, "Usage: %s <Blend name>\n The <Blend name> needs a matching config file webconf/<Blend name>.conf"\
@@ -94,7 +95,7 @@ if tasks.data['pkglist'] == '':
tasks.GetAllDependencies(source=1) # Set source=1 in case source packages should be displayed
packages = tasks.GetNamesAndSourceDict(dependencystatus=('official_high', 'official_low', 'non-free', 'experimental'))
-outputdir = tasks.CheckOrCreateOutputDir('bugs')
+outputdir = CheckOrCreateOutputDir(tasks.data['outputdir'],'bugs')
if outputdir == None:
exit(-1)
diff --git a/webtools/tasks.py b/webtools/tasks.py
index 89137c9..9a16788 100755
--- a/webtools/tasks.py
+++ b/webtools/tasks.py
@@ -17,7 +17,7 @@ from genshi.template import TemplateLoader
from genshi import Markup
from genshi.template.eval import UndefinedError
-from blendstasktools import Tasks, GetDependencies2Use, pkgstatus, pkgstatus_sortedkeys, UnlockBlendsTools
+from blendstasktools import Tasks, GetDependencies2Use, pkgstatus, pkgstatus_sortedkeys, UnlockBlendsTools, CheckOrCreateOutputDir
from blendsunicode import to_unicode
from blendslanguages import languages, language_dict
@@ -66,7 +66,7 @@ for lang in languages:
# initialize gensi
loader = TemplateLoader([template_dir], auto_reload=True)
-outputdir = tasks.CheckOrCreateOutputDir('tasks')
+outputdir = CheckOrCreateOutputDir(tasks.data['outputdir'],'tasks')
if outputdir == None:
exit(-1)
diff --git a/webtools/thermometer.py b/webtools/thermometer.py
index 73d4b85..2f95848 100755
--- a/webtools/thermometer.py
+++ b/webtools/thermometer.py
@@ -20,7 +20,7 @@ from genshi.template import TemplateLoader
from genshi import Markup
from genshi.template.eval import UndefinedError
-from blendstasktools import ReadConfig, RowDictionaries
+from blendstasktools import ReadConfig, RowDictionaries, CheckOrCreateOutputDir
###########################################################################################
# Define several prepared statements to query UDD
@@ -271,8 +271,7 @@ def main():
# initialize gensi
loader = TemplateLoader([template_dir], auto_reload=True)
- #outputdir = tasks.CheckOrCreateOutputDir('thermometer')
- outputdir = './thermometer'
+ outputdir = CheckOrCreateOutputDir(config['outputdir'],'thermometer')
if outputdir == None:
exit(-1)
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list