Browse Source

Group package meta in a module to have version/author/url in only one file.

pull/17/merge
Simon 13 years ago
parent
commit
75c6742698
  1. 26
      docs/conf.py
  2. 12
      setup.py
  3. 5
      sigal/__init__.py
  4. 8
      sigal/pkgmeta.py
  5. 4
      sigal/writer.py

26
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.

12
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,

5
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'

8
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__']

4
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': [],

Loading…
Cancel
Save