summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Waldmann <tw AT waldmann-edv DOT de>2011-07-09 21:19:05 +0200
committerThomas Waldmann <tw AT waldmann-edv DOT de>2011-07-09 21:19:05 +0200
commitb8bad8dfcd30004a0cf9a5e01d49618703698c9a (patch)
tree596b1a5ee73026569fa6f5a62040b5c621aa986d
parenta6c9053291dc6942db3e36cbd1f09cc0b11c5aae (diff)
downloadxstatic-b8bad8dfcd30004a0cf9a5e01d49618703698c9a.tar.gz
use a module for metadata, not a class, solves import/dependency issue0.0.2
-rw-r--r--setup.py7
-rw-r--r--xstatic/main.py11
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)