From 7887071c451562c976a05a352acae70eb0e683d9 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 22 Jun 2012 12:04:43 +0200 Subject: [PATCH 1/3] Updated setup.py to be less of a PEP8 violation. I know I know, I'm a hobgoblin. --- setup.py | 70 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/setup.py b/setup.py index 7619ad329..632cd5b6e 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,30 @@ -import sys, os, shutil +import os +import shutil +import sys + try: from setuptools import setup - entry_points = """ -[console_scripts] -virtualenv = virtualenv:main -virtualenv-%s.%s = virtualenv:main -""" % sys.version_info[:2] - kw = {'entry_points': entry_points.strip(), - 'zip_safe': False, - 'test_suite': 'nose.collector', - 'tests_require': ['nose', 'Mock'], - } + setup_params = { + 'entry_points': { + 'console_scripts': [ + 'virtualenv=virtualenv:main', + 'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2] + ], + }, + 'zip_safe': False, + 'test_suite': 'nose.collector', + 'tests_require': ['nose', 'Mock'], + } except ImportError: from distutils.core import setup if sys.platform == 'win32': print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"') - kw = {} + setup_params = {} else: script = 'scripts/virtualenv' script_ver = script + '-%s.%s' % sys.version_info[:2] shutil.copy(script, script_ver) - kw = {'scripts': [script, script_ver]} + setup_params = {'scripts': [script, script_ver]} here = os.path.dirname(os.path.abspath(__file__)) @@ -43,13 +47,14 @@ except ImportError: pass -setup(name='virtualenv', - # If you change the version here, change it in virtualenv.py and - # docs/conf.py as well - version="1.7.1.2.post1", - description="Virtual Python Environment builder", - long_description=long_description, - classifiers=[ +setup( + name='virtualenv', + # If you change the version here, change it in virtualenv.py and + # docs/conf.py as well + version="1.7.1.2.post1", + description="Virtual Python Environment builder", + long_description=long_description, + classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', @@ -61,16 +66,15 @@ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.2', - ], - keywords='setuptools deployment installation distutils', - author='Ian Bicking', - author_email='ianb@colorstudy.com', - maintainer='Jannis Leidel, Carl Meyer and Brian Rosner', - maintainer_email='python-virtualenv@groups.google.com', - url='http://www.virtualenv.org', - license='MIT', - py_modules=['virtualenv'], - packages=['virtualenv_support'], - package_data={'virtualenv_support': ['*-py%s.egg' % sys.version[:3], '*.tar.gz']}, - **kw - ) + ], + keywords='setuptools deployment installation distutils', + author='Ian Bicking', + author_email='ianb@colorstudy.com', + maintainer='Jannis Leidel, Carl Meyer and Brian Rosner', + maintainer_email='python-virtualenv@groups.google.com', + url='http://www.virtualenv.org', + license='MIT', + py_modules=['virtualenv'], + packages=['virtualenv_support'], + package_data={'virtualenv_support': ['*-py%s.egg' % sys.version[:3], '*.tar.gz']}, + **setup_params) From 68e63e26f87de5d484f689b6b2afe5b7cd78255b Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 22 Jun 2012 12:06:27 +0200 Subject: [PATCH 2/3] Use the codecs module to load the virtualenv.py when creating a bootstrap file. Fixes #280. --- AUTHORS.txt | 1 + docs/news.txt | 2 ++ virtualenv.py | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 596a79e00..c4366be88 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -43,6 +43,7 @@ Lars Francke Mike Hommey Miki Tebeka Philip Jenvey +Raul Leal Ronny Pfannschmidt Stefano Rivera Tarek Ziadé diff --git a/docs/news.txt b/docs/news.txt index 633959bcc..5aa5b09d2 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -36,6 +36,8 @@ develop (unreleased) * Fixed PyPy and Jython support on Windows. Thanks Konstantin Zemlyak. +* Fixed creating a bootstrap script on Python 3. Thanks Raul Leal. Fixes #280. + 1.7.1.2 (2012-02-17) ~~~~~~~~~~~~~~~~~~~~ diff --git a/virtualenv.py b/virtualenv.py index 731cfd339..4f6482c0c 100755 --- a/virtualenv.py +++ b/virtualenv.py @@ -9,6 +9,7 @@ import base64 import sys import os +import codecs import optparse import re import shutil @@ -1769,7 +1770,7 @@ def after_install(options, home_dir): filename = __file__ if filename.endswith('.pyc'): filename = filename[:-1] - f = open(filename, 'rb') + f = codecs.open(filename, 'r', encoding='utf-8') content = f.read() f.close() py_exe = 'python%s' % python_version From 0e6e1aac338da0d4ae9acf1050f86852920c6cf0 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 22 Jun 2012 12:06:55 +0200 Subject: [PATCH 3/3] Added note about the pydoc being added. --- AUTHORS.txt | 1 + docs/news.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index c4366be88..53e4859b0 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -40,6 +40,7 @@ Josh Bronson Konstantin Zemlyak Kumar McMillan Lars Francke +Marc Abramowitz Mike Hommey Miki Tebeka Philip Jenvey diff --git a/docs/news.txt b/docs/news.txt index 5aa5b09d2..195010e5d 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -36,6 +36,8 @@ develop (unreleased) * Fixed PyPy and Jython support on Windows. Thanks Konstantin Zemlyak. +* Added pydoc script to ease use. Thanks Marc Abramowitz. Fixes #149. + * Fixed creating a bootstrap script on Python 3. Thanks Raul Leal. Fixes #280. 1.7.1.2 (2012-02-17)