From fb43a4b255d981d6f725082d8becc195b9096512 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 9 Jul 2011 21:24:02 +0200 Subject: [PATCH] adapt XStatic-jQuery for XStatic >= 0.0.2 --- README.txt | 4 +- setup.py | 28 ++++---- xstatic/pkg/jquery/__init__.py | 120 ++++++++++++++++----------------- 3 files changed, 74 insertions(+), 78 deletions(-) diff --git a/README.txt b/README.txt index a3bc308..cb1b4d1 100644 --- a/README.txt +++ b/README.txt @@ -6,8 +6,8 @@ jQuery javascript library packaged for setuptools (easy_install) / pip. This package is intended to be used by **any** project that needs these files. It intentionally does **not** provide any extra code except some metadata -**nor** has any extra requirements except the minimal support code in the -XStatic base package. +**nor** has any extra requirements. You MAY use some minimal support code from +the XStatic base package, if you like. You can find more info about the xstatic packaging way in the package `XStatic`. diff --git a/setup.py b/setup.py index 9829f90..bf9da86 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,27 @@ -from setuptools import setup, find_packages - -from xstatic.pkg.jquery import JQuery as xs +from xstatic.pkg import jquery as xs # 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-' + xs.display_name, - version=xs.version, - description=xs.description, + name=xs.PACKAGE_NAME, + version=xs.PACKAGE_VERSION, + description=xs.DESCRIPTION, long_description=long_description, - classifiers=xs.classifiers, - keywords=xs.keywords, - author=xs.author, - author_email=xs.author_email, - license=xs.license, - url=xs.homepage, - platforms=xs.platforms, + classifiers=xs.CLASSIFIERS, + keywords=xs.KEYWORDS, + maintainer=xs.MAINTAINER, + maintainer_email=xs.MAINTAINER_EMAIL, + license=xs.LICENSE, + url=xs.HOMEPAGE, + platforms=xs.PLATFORMS, packages=find_packages(), namespace_packages=['xstatic', 'xstatic.pkg', ], include_package_data=True, zip_safe=False, - install_requires=['XStatic==0.0.1'], # this is just a MINIMAL support code package + install_requires=[], # nothing! :) + # if you like, you MAY use the 'XStatic' package. ) diff --git a/xstatic/pkg/jquery/__init__.py b/xstatic/pkg/jquery/__init__.py index a963d08..3fe984b 100644 --- a/xstatic/pkg/jquery/__init__.py +++ b/xstatic/pkg/jquery/__init__.py @@ -1,68 +1,64 @@ """ -jQuery package +XStatic resource package + +See package 'XStatic' for documentation and basic tools. """ +DISPLAY_NAME = 'jQuery' # official name, upper/lowercase allowed, no spaces +PACKAGE_NAME = 'XStatic-%s' % DISPLAY_NAME # name used for PyPi + +NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar') + # please use a all-lowercase valid python + # package name + +VERSION = '1.6.1' # version of the packaged files, please use the upstream + # version number +BUILD = '4' # our package build number, so we can release new builds + # with fixes for xstatic stuff. +PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi + +DESCRIPTION = "%s %s (XStatic packaging standard)" % (DISPLAY_NAME, VERSION) + +PLATFORMS = 'any' +CLASSIFIERS = [] +KEYWORDS = '%s xstatic' % NAME + +# XStatic-* package maintainer: +MAINTAINER = 'Thomas Waldmann' +MAINTAINER_EMAIL = 'tw@waldmann-edv.de' + +# this refers to the project homepage of the stuff we packaged: +HOMEPAGE = 'http://jquery.com/' + +# this refers to all files: +LICENSE = '(same as %s)' % DISPLAY_NAME + from os.path import join, dirname +BASE_DIR = join(dirname(__file__), 'data') +# linux package maintainers just can point to their file locations like this: +#BASE_DIR = '/usr/share/javascript/jquery' -try: - from xstatic.main import XStatic -except ImportError: - class XStatic(object): - """ - just a dummy for the time when setup.py is running and - for the case that xstatic is not already installed. - """ - -class JQuery(XStatic): - name = 'jquery' # short, all lowercase name - display_name = 'jQuery' # official name, upper/lowercase allowed - version = '1.6.1.3' # for simplicity, use same version x.y.z as bundled files - # additionally we append .b for our build number, so we - # can release new builds with fixes for xstatic stuff. - - base_dir = join(dirname(__file__), 'data') - # linux package maintainers just can point to their file locations like this: - # base_dir = '/usr/share/javascript/jquery' - - description = "%s (XStatic packaging standard)" % display_name - - platforms = 'any' - classifiers = [] - keywords = '%s xstatic' % name - - # this all refers to the XStatic-* package: - author = 'Thomas Waldmann' - author_email = 'tw@waldmann-edv.de' - # XXX shall we have another bunch of entries for the bundled files? - # like upstream_author/homepage/download/...? - # note: distutils/register can't handle author and maintainer at once. - - # this refers to the project homepage of the stuff we packaged: - homepage = 'http://jquery.com/' - - # this refers to all files: - license = '(same as %s)' % display_name - - locations = { - # if value is a string, it is a base location, just append relative - # path/filename. if value is a dict, do another lookup using the - # relative path/filename you want. - # your relative path/filenames should usually be without version - # information, because either the base dir/url is exactly for this - # version or the mapping will care for accessing this version. - ('google', 'http'): 'http://ajax.googleapis.com/ajax/libs/jquery/%s' % version, - ('google', 'https'): 'https://ajax.googleapis.com/ajax/libs/jquery/%s' % version, - ('jquery', 'http'): { - 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % version, - 'jquery.min.js': 'http://code.jquery.com/jquery-%s.min.js' % version, - }, - ('microsoft', 'http'): { - 'jquery.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % version, - 'jquery.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % version, - }, - ('microsoft', 'https'): { - 'jquery.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % version, - 'jquery.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % version, - }, - } +LOCATIONS = { + # CDN locations (if no public CDN exists, use an empty dict) + # if value is a string, it is a base location, just append relative + # path/filename. if value is a dict, do another lookup using the + # relative path/filename you want. + # your relative path/filenames should usually be without version + # information, because either the base dir/url is exactly for this + # version or the mapping will care for accessing this version. + ('google', 'http'): 'http://ajax.googleapis.com/ajax/libs/jquery/%s' % VERSION, + ('google', 'https'): 'https://ajax.googleapis.com/ajax/libs/jquery/%s' % VERSION, + ('jquery', 'http'): { + 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION, + 'jquery.min.js': 'http://code.jquery.com/jquery-%s.min.js' % VERSION, + }, + ('microsoft', 'http'): { + 'jquery.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION, + 'jquery.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION, + }, + ('microsoft', 'https'): { + 'jquery.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION, + 'jquery.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION, + }, +}