From 7057ca1c72f66e5b9195227bc7db90cf4a5cb492 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 16 Feb 2012 21:50:28 -0500 Subject: [PATCH] Respect UTF-8 README in setup.py. Also make a few minor changes to hooke/__init__.py so I can use $ python3 setup.py register -r pypi to push the new metadata to PyPI. Using Python 3 works around http://bugs.python.org/issue13114. I also had to explicitly convert classifiers to a list to avoid: Server response (400): Invalid classifier "" --- hooke/__init__.py | 9 +++++++-- setup.py | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hooke/__init__.py b/hooke/__init__.py index 13bcc68..9a04fec 100644 --- a/hooke/__init__.py +++ b/hooke/__init__.py @@ -25,14 +25,19 @@ The available submodules are: * :mod:`hooke.config` * :mod:`hooke.compat` """ + +import sys as _sys + try: from .license import LICENSE as __license__ -except ImportError, e: +except ImportError as e: import logging logging.warn('could not load LICENSE from hooke.license') __license__ = 'All rights reserved.' -from .util import yaml # extend YAML to parse Hooke-specific items. +if _sys.version_info < (3,0): + # yaml library not yet compatible with Python 3 + from .util import yaml # extend YAML to parse Hooke-specific items. __version__ = (1, 0, 0, 'alpha', None, 'Ninken') """Version tuple:: diff --git a/setup.py b/setup.py index 837a3c1..5d829bb 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ "Tools for analyzing force spectroscopy data." +import codecs from distutils.core import setup from os import walk import os.path @@ -58,8 +59,9 @@ setup(name="Hooke", license = "GNU Lesser General Public License (LGPL)", platforms = ["all"], description = __doc__, - long_description=open(os.path.join(_this_dir, 'README'), 'r').read(), - classifiers = filter(None, classifiers.split("\n")), + long_description=codecs.open( + os.path.join(_this_dir, 'README'), 'r', encoding='utf-8').read(), + classifiers = list(filter(None, classifiers.split("\n"))), scripts = ['bin/hk.py'], packages = packages, provides = packages, -- 2.26.2