From 74c2449d8f0fe4e6ae8c237835b438f87dfc9aad Mon Sep 17 00:00:00 2001 From: Andrea Crotti Date: Fri, 16 Mar 2012 14:27:26 +0000 Subject: [PATCH 1/5] add version information in __init__.py and import them from setup.py and conf.py --- docs/conf.py | 6 ++++-- pelican/__init__.py | 4 +++- setup.py | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 6c4e1ce5..ac2d67ee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,6 +3,8 @@ import sys, os sys.path.append(os.path.abspath('..')) +from pelican import __version__, __major__ + # -- General configuration ----------------------------------------------------- templates_path = ['_templates'] extensions = ['sphinx.ext.autodoc',] @@ -11,8 +13,8 @@ master_doc = 'index' project = u'Pelican' copyright = u'2010, Alexis Metaireau and contributors' exclude_patterns = ['_build'] -version = "2" -release = version +version = __version__ +release = __major__ # -- Options for HTML output --------------------------------------------------- diff --git a/pelican/__init__.py b/pelican/__init__.py index 5ffcc3b5..780938a7 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -11,7 +11,9 @@ from pelican.utils import clean_output_dir, files_changed from pelican.writers import Writer from pelican import log -__version__ = "3.0" +__major__ = 3 +__minor__ = 0 +__version__ = "{0}.{1}".format(__major__, __minor__) class Pelican(object): diff --git a/setup.py b/setup.py index 910499de..d26ad5f4 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -VERSION = "3.0" # find a better way to do so. +from pelican import __version__ requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'pytz'] @@ -21,7 +21,7 @@ entry_points = { setup( name = "pelican", - version = VERSION, + version = __version__, url = 'http://pelican.notmyidea.org/', author = 'Alexis Metaireau', author_email = 'alexis@notmyidea.org', From df8b71f8110566351db3fdc358fcf8ff65d6bdcf Mon Sep 17 00:00:00 2001 From: Andrea Crotti Date: Fri, 16 Mar 2012 14:27:51 +0000 Subject: [PATCH 2/5] remove unused *bat include --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index fc46d905..a092ecd0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,3 @@ include *.rst global-include *.py recursive-include pelican *.html *.css *png include LICENSE -global-include *.bat From 26078ecc175764c138b8415c70ba85aecbb81565 Mon Sep 17 00:00:00 2001 From: Andrea Crotti Date: Fri, 16 Mar 2012 14:50:26 +0000 Subject: [PATCH 3/5] remove unused colors and refactor more how the escaping is done --- pelican/log.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/pelican/log.py b/pelican/log.py index 027743d0..c5e9b688 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -8,31 +8,25 @@ from logging import Formatter, getLogger, StreamHandler RESET_TERM = u'\033[0;m' -def term_color(code): - return lambda text: code + unicode(text) + RESET_TERM +def start_color(index): + return u'\033[1;{0}m'.format(index) + + +def term_color(color): + code = COLOR_CODES[color] + return lambda text: start_color(code) + unicode(text) + RESET_TERM COLOR_CODES = { - 'gray': u'\033[1;30m', - 'red': u'\033[1;31m', - 'green': u'\033[1;32m', - 'yellow': u'\033[1;33m', - 'blue': u'\033[1;34m', - 'magenta': u'\033[1;35m', - 'cyan': u'\033[1;36m', - 'white': u'\033[1;37m', - 'bgred': u'\033[1;41m', - 'bggreen': u'\033[1;42m', - 'bgbrown': u'\033[1;43m', - 'bgblue': u'\033[1;44m', - 'bgmagenta': u'\033[1;45m', - 'bgcyan': u'\033[1;46m', - 'bggray': u'\033[1;47m', - 'bgyellow': u'\033[1;43m', - 'bggrey': u'\033[1;100m', + 'red': 31, + 'yellow': 33, + 'cyan': 36, + 'white': 37, + 'bgred': 41, + 'bggrey': 100, } -ANSI = dict((col, term_color(code)) for col, code in COLOR_CODES.items()) +ANSI = dict((col, term_color(col)) for col in COLOR_CODES) class ANSIFormatter(Formatter): From 173133dbf34b322511feb36663e189709e505949 Mon Sep 17 00:00:00 2001 From: Andrea Crotti Date: Fri, 16 Mar 2012 14:53:28 +0000 Subject: [PATCH 4/5] remove couple of extra spaces --- pelican/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/log.py b/pelican/log.py index c5e9b688..8811b372 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -1,6 +1,6 @@ import os import sys -from logging import CRITICAL, ERROR, WARN, INFO, DEBUG +from logging import CRITICAL, ERROR, WARN, INFO, DEBUG from logging import critical, error, info, warning, warn, debug from logging import Formatter, getLogger, StreamHandler @@ -74,7 +74,7 @@ class DummyFormatter(object): and not sys.platform.startswith('win'): return ANSIFormatter(*args, **kwargs) else: - return TextFormatter( *args, **kwargs) + return TextFormatter(*args, **kwargs) def init(level=None, logger=getLogger(), handler=StreamHandler()): From 4e4af9d011625f79c04a6ab1d55de892dbaf5149 Mon Sep 17 00:00:00 2001 From: Andrea Crotti Date: Fri, 16 Mar 2012 18:53:08 +0000 Subject: [PATCH 5/5] move tools in pelican.tools and add the pelican.tools package to setup.py --- {tools => pelican/tools}/__init__.py | 0 {tools => pelican/tools}/pelican_import.py | 0 {tools => pelican/tools}/pelican_quickstart.py | 0 {tools => pelican/tools}/pelican_themes.py | 0 setup.py | 8 ++++---- 5 files changed, 4 insertions(+), 4 deletions(-) rename {tools => pelican/tools}/__init__.py (100%) rename {tools => pelican/tools}/pelican_import.py (100%) rename {tools => pelican/tools}/pelican_quickstart.py (100%) rename {tools => pelican/tools}/pelican_themes.py (100%) diff --git a/tools/__init__.py b/pelican/tools/__init__.py similarity index 100% rename from tools/__init__.py rename to pelican/tools/__init__.py diff --git a/tools/pelican_import.py b/pelican/tools/pelican_import.py similarity index 100% rename from tools/pelican_import.py rename to pelican/tools/pelican_import.py diff --git a/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py similarity index 100% rename from tools/pelican_quickstart.py rename to pelican/tools/pelican_quickstart.py diff --git a/tools/pelican_themes.py b/pelican/tools/pelican_themes.py similarity index 100% rename from tools/pelican_themes.py rename to pelican/tools/pelican_themes.py diff --git a/setup.py b/setup.py index 910499de..a8e0f57d 100755 --- a/setup.py +++ b/setup.py @@ -13,9 +13,9 @@ except ImportError: entry_points = { 'console_scripts': [ 'pelican = pelican:main', - 'pelican-import = tools.pelican_import:main', - 'pelican-quickstart = tools.pelican_quickstart:main', - 'pelican-themes = tools.pelican_themes:main' + 'pelican-import = pelican.tools.pelican_import:main', + 'pelican-quickstart = pelican.tools.pelican_quickstart:main', + 'pelican-themes = pelican.tools.pelican_themes:main' ] } @@ -27,7 +27,7 @@ setup( author_email = 'alexis@notmyidea.org', description = "A tool to generate a static blog from reStructuredText or Markdown input files.", long_description=open('README.rst').read(), - packages = ['pelican'], + packages = ['pelican', 'pelican.tools'], include_package_data = True, install_requires = requires, entry_points = entry_points,