Changeset 1357 in products
- Timestamp:
- Nov 1, 2009 11:07:11 AM (14 years ago)
- Location:
- quintagroup.themetemplate/trunk
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.themetemplate/trunk/docs/HISTORY.txt
r1022 r1357 2 2 ========= 3 3 4 0.1 2(unreleased)4 0.14 (unreleased) 5 5 ----------------- 6 6 7 - Nothing changed yet. 7 - Refactoring theme vars storage-now storing in separate 8 theme_vars.cfg file, without distutils writers [mylan] 9 - Cleanup code [mylan] 8 10 9 11 -
quintagroup.themetemplate/trunk/quintagroup/themetemplate/__init__.py
r1005 r1357 1 1 # 2 import os,types 3 from StringIO import StringIO 4 from ConfigParser import SafeConfigParser 2 import os 3 from paste.script import pluginlib 5 4 6 5 from quintagroup.themetemplate.qplone3_theme import qPlone3Theme 7 6 8 def write_map(cmd, basename, filename, force=False): 9 argname = os.path.splitext(basename)[0] 10 value = getattr(cmd.distribution, argname, None) 7 def getEggInfo(output_dir): 8 """ Return path to egg info directory, raise error if not found. 9 """ 10 egg_info = pluginlib.find_egg_info_dir(output_dir) 11 assert egg_info is not None, "egg_info directory must present for the package" 11 12 12 if value: 13 config = SafeConfigParser() 14 config.add_section('qplone3_theme') 15 for name, val in value.items(): 16 val = val and str(val) or '' 17 config.set('qplone3_theme', name, val) 18 19 strvalue = StringIO() 20 config.write(strvalue) 21 value = strvalue.getvalue() 22 23 cmd.write_or_delete_file(argname, filename, value, force) 13 return egg_info 24 14 25 15 26 def assert_dict(dist, attr, value): 27 """Verify that value is a dict or None""" 28 try: 29 assert type(value) == types.DictType 30 except (TypeError,ValueError,AttributeError,AssertionError): 31 raise DistutilsSetupError( 32 "%r must be a dict (got %r)" % (attr,value) 33 ) 16 def getThemeVarsFP(egg_info): 17 """ Return file system path to theme vars configurations 18 """ 19 return os.path.join(egg_info, '..', 'theme_vars.cfg') -
quintagroup.themetemplate/trunk/quintagroup/themetemplate/localcommands/__init__.py
r1005 r1357 4 4 import os 5 5 from ConfigParser import SafeConfigParser 6 from paste.script import pluginlib7 6 8 7 from zopeskel.base import var 9 8 from zopeskel.localcommands import ZopeSkelLocalTemplate 9 10 from quintagroup.themetemplate import getEggInfo 11 from quintagroup.themetemplate import getThemeVarsFP 10 12 11 13 class QThemeSubTemplate(ZopeSkelLocalTemplate): … … 58 60 59 61 res = {} 60 egg_info = pluginlib.find_egg_info_dir(output_dir)61 theme_vars_fp = os.path.join(egg_info, 'theme_vars.txt')62 egg_info = getEggInfo(output_dir) 63 theme_vars_fp = getThemeVarsFP(egg_info) 62 64 63 if egg_info andos.path.exists(theme_vars_fp):65 if os.path.exists(theme_vars_fp): 64 66 config = SafeConfigParser() 65 67 config.read(theme_vars_fp) … … 77 79 def add_template_vars(self, output_dir, vars): 78 80 79 egg_info = pluginlib.find_egg_info_dir(output_dir)80 theme_vars_fp = os.path.join(egg_info, 'theme_vars.txt')81 egg_info = getEggInfo(output_dir) 82 theme_vars_fp = getThemeVarsFP(egg_info) 81 83 82 if egg_info andos.path.exists(theme_vars_fp):84 if os.path.exists(theme_vars_fp): 83 85 config = SafeConfigParser() 84 86 config.read(theme_vars_fp) -
quintagroup.themetemplate/trunk/quintagroup/themetemplate/localcommands/subtemplates.py
r1005 r1357 8 8 from zopeskel.base import var 9 9 from zopeskel.localcommands import ZopeSkelLocalTemplate 10 11 from quintagroup.themetemplate import getEggInfo 12 from quintagroup.themetemplate import getThemeVarsFP 10 13 from quintagroup.themetemplate.localcommands import QThemeSubTemplate 11 14 … … 156 159 def add_order_tag(self, output_dir, vars, pmarker): 157 160 need_update = True 158 egg_info = pluginlib.find_egg_info_dir(output_dir)159 theme_vars_fp = os.path.join(egg_info, 'theme_vars.txt')160 161 if egg_info andos.path.exists(theme_vars_fp):161 egg_info = getEggInfo(output_dir) 162 theme_vars_fp = getThemeVarsFP(egg_info) 163 164 if os.path.exists(theme_vars_fp): 162 165 config = SafeConfigParser() 163 166 config.read(theme_vars_fp) … … 215 218 def add_hidden_tag(self, output_dir, vars, pmarker): 216 219 add_hidden = True 217 egg_info = pluginlib.find_egg_info_dir(output_dir)218 theme_vars_fp = os.path.join(egg_info, 'theme_vars.txt')219 220 if egg_info andos.path.exists(theme_vars_fp):220 egg_info = getEggInfo(output_dir) 221 theme_vars_fp = getThemeVarsFP(egg_info) 222 223 if os.path.exists(theme_vars_fp): 221 224 config = SafeConfigParser() 222 225 config.read(theme_vars_fp) -
quintagroup.themetemplate/trunk/quintagroup/themetemplate/templates/qplone3_theme/setup.py_tmpl
r1005 r1357 45 45 entry_points=""" 46 46 # -*- entry_points -*- # 47 48 [distutils.setup_keywords]49 paster_plugins = setuptools.dist:assert_string_list50 theme_vars = distwriters:assert_dict51 52 [egg_info.writers]53 paster_plugins.txt = setuptools.command.egg_info:write_arg54 theme_vars.txt = distwriters:write_map55 56 47 """, 57 48 paster_plugins = ["ZopeSkel",], 58 49 setup_requires = ["setuptools",], 59 theme_vars = {'skinname': '$skinname',60 'skinbase' : '$skinbase',61 'namespace_package' : '$namespace_package',62 'namespace_package2': '$namespace_package2',63 'package' : '$package',64 'used_subtemplates' : '',65 },66 50 ) -
quintagroup.themetemplate/trunk/setup.py
r1022 r1357 2 2 import os 3 3 4 version = '0.1 2 dev'4 version = '0.14' 5 5 6 6 tests_require=['zope.testing'] … … 48 48 import_zexps = quintagroup.themetemplate.localcommands.subtemplates:ImportSubTemplate 49 49 50 [distutils.setup_keywords]51 theme_vars = quintagroup.themetemplate:assert_dict52 53 [egg_info.writers]54 theme_vars.txt = quintagroup.themetemplate:write_map55 56 50 # -*- Entry points: -*- 57 51 """,
Note: See TracChangeset
for help on using the changeset viewer.