Simplified the version handling further, compressor.__version__ is now the canonical location following well defined Python best practices.

This commit is contained in:
Jannis Leidel
2012-02-14 19:32:26 +01:00
parent 027878a70f
commit 835ed4ef70
5 changed files with 42 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
django_compressor
-----------------
Copyright (c) 2009-2011 django_compressor authors (see AUTHORS file)
Copyright (c) 2009-2012 Django Compressor authors (see AUTHORS file)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,2 +1,2 @@
# following PEP 386, versiontools will pick it up
__version__ = (1, 1, 2, "post", 1)
# following PEP 386
__version__ = "1.2a1"

View File

@@ -1,8 +1,8 @@
Changelog
=========
v1.2.0 (in development)
-----------------------
v1.2 (in development)
---------------------
- Introduced a new ``compressed`` context dictionary that is passed to
the templates that are responsible for rendering the compressed snippets.

View File

@@ -16,7 +16,7 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration -----------------------------------------------------
@@ -47,10 +47,14 @@ copyright = u'2012, Django Compressor authors'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.1'
# The full version, including alpha/beta/rc tags.
release = '1.1.2'
try:
from compressor import __version__
# The short X.Y version.
version = '.'.join(__version__.split('.')[:2])
# The full version, including alpha/beta/rc tags.
release = __version__
except ImportError:
version = release = 'dev'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@@ -1,12 +1,24 @@
import os
import re
import sys
import codecs
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
def read(*parts):
return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
# Provided as an attribute, so you can append to these instead
# of replicating them:
@@ -14,6 +26,7 @@ standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# Note: you may want to copy this into your setup.py file verbatim, as
@@ -98,17 +111,17 @@ def find_package_data(
return out
setup(
name = "django_compressor",
version = "1.1.2.post1",
url = 'http://django_compressor.readthedocs.org/',
license = 'MIT',
description = "Compresses linked and inline JavaScript or CSS into single cached files.",
long_description = read('README.rst'),
author = 'Jannis Leidel',
author_email = 'jannis@leidel.info',
packages = find_packages(),
package_data = find_package_data(),
classifiers = [
name="django_compressor",
version=find_version("compressor", "__init__.py"),
url='http://django_compressor.readthedocs.org/',
license='MIT',
description="Compresses linked and inline JavaScript or CSS into single cached files.",
long_description=read('README.rst'),
author='Jannis Leidel',
author_email='jannis@leidel.info',
packages=find_packages(),
package_data=find_package_data(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Intended Audience :: Developers',
@@ -120,8 +133,8 @@ setup(
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
],
zip_safe = False,
install_requires = [
zip_safe=False,
install_requires=[
'django-appconf >= 0.4',
],
)