diff --git a/pout.py b/pout.py index ac1f671..acd0e13 100644 --- a/pout.py +++ b/pout.py @@ -47,7 +47,7 @@ # pout2.b("remember to remove pout2") # except ImportError: pass -__version__ = '0.6.2' +__version__ = '0.6.3' logger = logging.getLogger(__name__) @@ -337,7 +337,7 @@ def _add_indent(self, val, indent_count): # return s.fill(val) s = val.split('\n') - s = [(u"\t" * indent_count) + line for line in s] + s = [(u"\t" * indent_count) + self._get_unicode(line) for line in s] s = u"\n".join(s) return s diff --git a/setup.py b/setup.py index 06a7523..4d0fd8a 100644 --- a/setup.py +++ b/setup.py @@ -2,21 +2,13 @@ # http://docs.python.org/distutils/setupscript.html # http://docs.python.org/2/distutils/examples.html -import sys from setuptools import setup -import ast +import re +import os -name = 'pout' -version = '' -with open('{}.py'.format(name), 'rU') as f: - for node in (n for n in ast.parse(f.read()).body if isinstance(n, ast.Assign)): - node_name = node.targets[0] - if isinstance(node_name, ast.Name) and node_name.id.startswith('__version__'): - version = node.value.s - break - -if not version: - raise RuntimeError('Unable to find version number') +name = "pout" +with open(os.path.join("{}.py".format(name))) as f: + version = re.search("^__version__\s*=\s*[\'\"]([^\'\"]+)", f.read(), flags=re.I | re.M).group(1) setup( name=name,