diff --git a/docs/conf.py b/docs/conf.py index f6d36cb..95c3e7f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,13 +11,19 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import re +import sys # 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.append(os.path.abspath('..')) +pkgmeta = {} +execfile(os.path.join(os.path.dirname(__file__), '..', 'sigal', 'pkgmeta.py'), + pkgmeta) + # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -41,16 +47,16 @@ master_doc = 'index' # General information about the project. project = u'Sigal' -copyright = u'2012, Simon Conseil' +copyright = u'2012-2013, ' + pkgmeta['__author__'] # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.3.1' +version = re.match('\d+\.\d+', pkgmeta['__version__']).group() # The full version, including alpha/beta/rc tags. -release = '0.3.1' +release = pkgmeta['__version__'] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -188,7 +194,7 @@ latex_elements = { # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Sigal.tex', u'Sigal Documentation', - u'Simon Conseil', 'manual'), + pkgmeta['__author__'], 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -218,7 +224,7 @@ latex_documents = [ # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'sigal', u'Sigal Documentation', - [u'Simon Conseil'], 1) + [pkgmeta['__author__']], 1) ] # If true, show URL addresses after external links. @@ -232,7 +238,7 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ ('index', 'Sigal', u'Sigal Documentation', - u'Simon Conseil', 'Sigal', 'One line description of project.', + pkgmeta['__author__'], 'Sigal', 'One line description of project.', 'Miscellaneous'), ] @@ -250,9 +256,9 @@ texinfo_documents = [ # Bibliographic Dublin Core info. epub_title = u'Sigal' -epub_author = u'Simon Conseil' -epub_publisher = u'Simon Conseil' -epub_copyright = u'2012, Simon Conseil' +epub_author = pkgmeta['__author__'] +epub_publisher = pkgmeta['__author__'] +epub_copyright = u'2012, ' + pkgmeta['__author__'] # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/setup.py b/setup.py index f51c5fa..f3c6157 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ # -*- coding:utf-8 -*- +import os from setuptools import setup, find_packages requires = ['argh', 'clint', 'jinja2', 'Markdown'] @@ -16,12 +17,17 @@ entry_points = { with open('README.rst') as f: README = f.read() +# Load package meta from the pkgmeta module without loading the package. +pkgmeta = {} +execfile(os.path.join(os.path.dirname(__file__), 'sigal', 'pkgmeta.py'), + pkgmeta) + setup( name='sigal', - version='0.3.1', - url='https://github.com/saimn/sigal', + version=pkgmeta['__version__'], + url=pkgmeta['__url__'], license='MIT', - author='Simon Conseil', + author=pkgmeta['__author__'], author_email='contact@saimon.org', description='Simple static gallery generator', long_description=README, diff --git a/sigal/__init__.py b/sigal/__init__.py index fbe9ddc..291a2e5 100644 --- a/sigal/__init__.py +++ b/sigal/__init__.py @@ -32,10 +32,6 @@ sigal is yet another python script to prepare a static gallery of images: from __future__ import absolute_import -__author__ = "Simon Conseil" -__version__ = "0.3.1" -__license__ = "MIT" - import codecs import logging import os @@ -44,6 +40,7 @@ from argh import ArghParser, arg from logging import Formatter from .gallery import Gallery +from .pkgmeta import * from .settings import read_settings _DEFAULT_CONFIG_FILE = 'sigal.conf.py' diff --git a/sigal/pkgmeta.py b/sigal/pkgmeta.py new file mode 100644 index 0000000..4f1ccb0 --- /dev/null +++ b/sigal/pkgmeta.py @@ -0,0 +1,8 @@ +# -*- coding:utf-8 -*- + +__title__ = 'sigal' +__author__ = u"Simon Conseil" +__version__ = "0.3.1-dev" +__license__ = "MIT" +__url__ = 'https://github.com/saimn/sigal' +__all__ = ['__title__', '__author__', '__version__', '__license__', '__url__'] diff --git a/sigal/writer.py b/sigal/writer.py index cf3623b..971f3a8 100644 --- a/sigal/writer.py +++ b/sigal/writer.py @@ -35,9 +35,9 @@ from jinja2.exceptions import TemplateNotFound from .image import Image from .settings import get_thumb +from .pkgmeta import __url__ as sigal_link INDEX_PAGE = "index.html" -SIGAL_LINK = "https://github.com/saimn/sigal" THEMES_PATH = os.path.normpath(os.path.join( os.path.abspath(os.path.dirname(__file__)), 'themes')) @@ -84,7 +84,7 @@ class Writer(object): self.copy_assets() self.ctx = { - 'sigal_link': SIGAL_LINK, + 'sigal_link': sigal_link, 'theme': {'name': os.path.basename(self.theme)}, 'images': [], 'albums': [],