From b8bad8dfcd30004a0cf9a5e01d49618703698c9a Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 9 Jul 2011 21:19:05 +0200 Subject: use a module for metadata, not a class, solves import/dependency issue --- setup.py | 7 +++---- xstatic/main.py | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 23eb6b5..8633c85 100644 --- a/setup.py +++ b/setup.py @@ -7,16 +7,15 @@ XStatic - setup.py Works with: setuptools """ -from setuptools import setup, find_packages - # The README.txt file should be written in reST so that PyPI can use # it to generate your project's PyPI page. long_description = open('README.txt').read() +from setuptools import setup, find_packages setup( name='XStatic', - version='0.0.1', + version='0.0.2', description='XStatic base package with minimal support code', long_description=long_description, classifiers=[ @@ -30,7 +29,7 @@ setup( 'Topic :: System :: Installation/Setup', 'Topic :: System :: Software Distribution', ], - keywords="static file resource python packages setuptools pypi require", + keywords="xstatic static file resource python packages setuptools pypi require", author='Thomas Waldmann', author_email='tw@waldmann-edv.de', url='http:/bitbucket.org/thomaswaldmann/xstatic', diff --git a/xstatic/main.py b/xstatic/main.py index 1ea94bf..b0a2bd2 100644 --- a/xstatic/main.py +++ b/xstatic/main.py @@ -10,18 +10,19 @@ class XStatic(object): minimal support code to access resources from xstatic.pkg.* files or CDN locations. """ - name = None # lowercase short name - base_dir = None # fs path to the files - locations = {} # CDN/remote locations - - def __init__(self, root_url='/xstatic', provider='local', protocol='http'): + def __init__(self, module, root_url='/xstatic', provider='local', protocol='http'): """ + :arg module: xstatic resource package/module, has metadata as attributes :arg root_url: the common root url path for all local xstatic resources :arg provider: 'local' to get it from local server or a name of another source (e.g. CDN) :arg protocol: 'http' (default) or 'https' """ + self.__dict__.update([(name.lower(), getattr(module, name)) + for name in dir(module) + if name.isupper() + ]) self.provider = provider if provider == 'local': self.base_url = "%s/%s" % (root_url, self.name) -- cgit v1.2.1