Skip to content
Snippets Groups Projects
Commit 19cd12f0 authored by Thomas Waldmann's avatar Thomas Waldmann
Browse files

use a module for metadata, not a class, solves import/dependency issue

parent 37c3155a
No related branches found
Tags 0.0.2
No related merge requests found
......@@ -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',
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment