Commit bac43dea authored by Philip Thiem's avatar Philip Thiem

py3 fixes

--HG--
extra : rebase_source : 29629f51bacee1ae8394c559e4440dafcb9179d1
parent c7bd4425
[distutils.commands]
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
rotate = setuptools.command.rotate:rotate
develop = setuptools.command.develop:develop
setopt = setuptools.command.setopt:setopt
build_py = setuptools.command.build_py:build_py
saveopts = setuptools.command.saveopts:saveopts
egg_info = setuptools.command.egg_info:egg_info
register = setuptools.command.register:register
upload_docs = setuptools.command.upload_docs:upload_docs
install_egg_info = setuptools.command.install_egg_info:install_egg_info
alias = setuptools.command.alias:alias
easy_install = setuptools.command.easy_install:easy_install
install_scripts = setuptools.command.install_scripts:install_scripts
bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
bdist_egg = setuptools.command.bdist_egg:bdist_egg
install = setuptools.command.install:install
test = setuptools.command.test:test
install_lib = setuptools.command.install_lib:install_lib
build_ext = setuptools.command.build_ext:build_ext
sdist = setuptools.command.sdist:sdist
[egg_info.writers]
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
requires.txt = setuptools.command.egg_info:write_requirements
PKG-INFO = setuptools.command.egg_info:write_pkg_info
eager_resources.txt = setuptools.command.egg_info:overwrite_arg
top_level.txt = setuptools.command.egg_info:write_toplevel_names
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
entry_points.txt = setuptools.command.egg_info:write_entries
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
[console_scripts]
easy_install-3.3 = setuptools.command.easy_install:main
easy_install = setuptools.command.easy_install:main
easy_install-2.7 = setuptools.command.easy_install:main
[setuptools.file_finders]
svn_cvs = setuptools.command.sdist:_default_revctrl
[setuptools.installation]
eggsecutable = setuptools.command.easy_install:bootstrap
[distutils.setup_keywords]
dependency_links = setuptools.dist:assert_string_list
entry_points = setuptools.dist:check_entry_points
zip_safe = setuptools.dist:assert_bool
extras_require = setuptools.dist:check_extras
use_2to3_exclude_fixers = setuptools.dist:assert_string_list
package_data = setuptools.dist:check_package_data
install_requires = setuptools.dist:check_requirements
use_2to3 = setuptools.dist:assert_bool
use_2to3_fixers = setuptools.dist:assert_string_list
include_package_data = setuptools.dist:assert_bool
packages = setuptools.dist:check_packages
exclude_package_data = setuptools.dist:check_package_data
namespace_packages = setuptools.dist:check_nsp
test_suite = setuptools.dist:check_test_suite
eager_resources = setuptools.dist:assert_string_list
zip_safe = setuptools.dist:assert_bool
test_loader = setuptools.dist:check_importable
packages = setuptools.dist:check_packages
use_2to3 = setuptools.dist:assert_bool
test_suite = setuptools.dist:check_test_suite
entry_points = setuptools.dist:check_entry_points
namespace_packages = setuptools.dist:check_nsp
convert_2to3_doctests = setuptools.dist:assert_string_list
test_loader = setuptools.dist:check_importable
use_2to3_fixers = setuptools.dist:assert_string_list
package_data = setuptools.dist:check_package_data
install_requires = setuptools.dist:check_requirements
tests_require = setuptools.dist:check_requirements
include_package_data = setuptools.dist:assert_bool
[setuptools.installation]
eggsecutable = setuptools.command.easy_install:bootstrap
[egg_info.writers]
PKG-INFO = setuptools.command.egg_info:write_pkg_info
requires.txt = setuptools.command.egg_info:write_requirements
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
entry_points.txt = setuptools.command.egg_info:write_entries
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
top_level.txt = setuptools.command.egg_info:write_toplevel_names
eager_resources.txt = setuptools.command.egg_info:overwrite_arg
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
[distutils.commands]
bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
install_scripts = setuptools.command.install_scripts:install_scripts
build_ext = setuptools.command.build_ext:build_ext
install_lib = setuptools.command.install_lib:install_lib
develop = setuptools.command.develop:develop
sdist = setuptools.command.sdist:sdist
saveopts = setuptools.command.saveopts:saveopts
easy_install = setuptools.command.easy_install:easy_install
rotate = setuptools.command.rotate:rotate
install = setuptools.command.install:install
alias = setuptools.command.alias:alias
install_egg_info = setuptools.command.install_egg_info:install_egg_info
register = setuptools.command.register:register
egg_info = setuptools.command.egg_info:egg_info
bdist_egg = setuptools.command.bdist_egg:bdist_egg
test = setuptools.command.test:test
upload_docs = setuptools.command.upload_docs:upload_docs
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
setopt = setuptools.command.setopt:setopt
build_py = setuptools.command.build_py:build_py
[setuptools.file_finders]
svn_cvs = setuptools.command.sdist:_default_revctrl
import os
import re
import sys
import codecs
from distutils import log
from xml.sax.saxutils import unescape
......@@ -8,15 +9,6 @@ from xml.sax.saxutils import unescape
from subprocess import Popen as _Popen, PIPE as _PIPE
def get_entries_files(base, recurse=True):
for base, dirs, _ in os.walk(os.curdir):
if '.svn' not in dirs:
dirs[:] = []
continue # no sense walking uncontrolled subdirs
dirs.remove('.svn')
f = open(os.path.join(base, '.svn', 'entries'))
yield f.read()
f.close()
#It would seem that svn info --xml and svn list --xml were fully
#supported by 1.3.x the special casing of the entry files seem to start at
......@@ -28,7 +20,19 @@ def get_entries_files(base, recurse=True):
# http://bugs.python.org/issue8557
# http://stackoverflow.com/questions/5658622/
# python-subprocess-popen-environment-path
def _run_command(args, stdout=_PIPE, stderr=_PIPE):
#regarding the shell argument, see: http://bugs.python.org/issue8557
proc = _Popen(args, stdout=stdout, stderr=stderr,
shell=(sys.platform=='win32'))
data = proc.communicate()[0]
#TODO: this is probably NOT always utf-8
try:
data = unicode(data, encoding='utf-8')
except NameError:
data = str(data, encoding='utf-8')
return proc.returncode, data
#TODO add the text entry back, and make its use dependent on the
# non existence of svn?
......@@ -44,10 +48,7 @@ class SVNEntries(object):
@staticmethod
def get_svn_tool_version():
proc = _Popen(['svn', '--version', '--quiet'],
stdout=_PIPE, stderr=_PIPE,
shell=(sys.platform=='win32'))
data = unicode(proc.communicate()[0], encoding='utf-8')
_, data = _run_command(['svn', '--version', '--quiet'])
if data:
return data.strip()
else:
......@@ -234,18 +235,14 @@ class SVNEntriesCMD(SVNEntries):
def get_dir_data(self):
#regarding the shell argument, see: http://bugs.python.org/issue8557
proc = _Popen(['svn', 'info', '--xml', self.path],
stdout=_PIPE, shell=(sys.platform=='win32'))
data = unicode(proc.communicate()[0], encoding='utf-8')
_, data = _run_command(['svn', 'info', '--xml', self.path])
self.dir_data = self.entryre.findall(data)
self.get_dir_data = self.__get_cached_dir_data
return self.dir_data
def get_entries(self):
#regarding the shell argument, see: http://bugs.python.org/issue8557
proc = _Popen(['svn', 'list', '--xml', self.path],
stdout=_PIPE, shell=(sys.platform=='win32'))
data = unicode(proc.communicate()[0], encoding='utf-8')
_, data = _run_command(['svn', 'list', '--xml', self.path])
self.entries = self.entryre.findall(data)
self.get_entries = self.__get_cached_entries
return self.entries
......@@ -285,11 +282,9 @@ class SVNEntriesCMD(SVNEntries):
if os.path.basename(filename).lower() != 'dir-props':
return ''
#regard the shell argument, see: http://bugs.python.org/issue8557
proc = _Popen(['svn', 'propget', 'svn:externals', self.path],
stdout=_PIPE, shell=(sys.platform=='win32'))
try:
lines = unicode(proc.communicate()[0], encoding='utf-8')
_, lines = _run_command(['svn',
'propget', 'svn:externals', self.path])
lines = [line for line in lines.splitlines() if line]
return lines
except ValueError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment