Commit b393354e authored by Jason R. Coombs's avatar Jason R. Coombs

Merge with remove-svn

parents 133272d7 7b82f0ad
......@@ -171,6 +171,7 @@ d62bf4e407b3b9b5bedcc1396a9ba46f35571902 8.0.1
995f6d9651312cd481ca1e5ddb271cbdd0474c57 8.2
efbe39dae0aba9a7db399f6442758ae94e315c93 8.2.1
cd14b2a72e51c7d13873ab6c2041f901b1a7a1cd 8.3
0eee586a153f068142c1a0df4bc2635ed2c1a1cc 9.0b1
921e60a0f9067311571fde9ccf2f35223159d9f6 8.4
0d7b9b63d06ab7f68bc8edd56cb2034e6395d7fc 9.0
fa069bf2411a150c9379d31a04d1c3836e2d3027 9.0.1
......
......@@ -8,6 +8,9 @@ python:
- pypy
# command to run tests
script:
# invoke bootstrap and override egg_info based on setup.py in checkout
- python bootstrap.py
- python setup.py egg_info
- python setup.py ptr
- python ez_setup.py --version 7.0
......@@ -2,6 +2,15 @@
CHANGES
=======
----
10.0
----
* Issue #313: Removed built-in support for subversion. Projects wishing to
retain support for subversion will need to use a third party library. The
extant implementation is being ported to `setuptools_svn
<https://pypi.python.org/pypi/setuptools_svn>`_.
---
future
---
......
......@@ -172,9 +172,6 @@ setup_params = dict(
],
"console_scripts": console_scripts,
"setuptools.file_finders":
["svn_cvs = setuptools.command.sdist:_default_revctrl"],
"setuptools.installation":
['eggsecutable = setuptools.command.easy_install:bootstrap'],
},
......
......@@ -11,10 +11,14 @@ import os
import re
import sys
try:
from setuptools_svn import svn_utils
except ImportError:
pass
from setuptools import Command
from setuptools.command.sdist import sdist
from setuptools.compat import basestring, PY3, StringIO
from setuptools import svn_utils
from setuptools.command.sdist import walk_revctrl
from pkg_resources import (
parse_requirements, safe_name, parse_version,
......@@ -190,6 +194,8 @@ class egg_info(Command):
@staticmethod
def get_svn_revision():
if 'svn_utils' not in globals():
return "0"
return str(svn_utils.SvnInfo.load(os.curdir).get_revision())
def find_sources(self):
......
from glob import glob
from distutils.util import convert_path
from distutils import log
import distutils.command.sdist as orig
import os
import re
import sys
from setuptools import svn_utils
from setuptools.compat import PY3
from setuptools.utils import cs_path_exists
......@@ -22,60 +19,6 @@ def walk_revctrl(dirname=''):
yield item
# TODO will need test case
class re_finder(object):
"""
Finder that locates files based on entries in a file matched by a
regular expression.
"""
def __init__(self, path, pattern, postproc=lambda x: x):
self.pattern = pattern
self.postproc = postproc
self.entries_path = convert_path(path)
def _finder(self, dirname, filename):
f = open(filename, 'rU')
try:
data = f.read()
finally:
f.close()
for match in self.pattern.finditer(data):
path = match.group(1)
# postproc was formerly used when the svn finder
# was an re_finder for calling unescape
path = self.postproc(path)
yield svn_utils.joinpath(dirname, path)
def find(self, dirname=''):
path = svn_utils.joinpath(dirname, self.entries_path)
if not os.path.isfile(path):
# entries file doesn't exist
return
for path in self._finder(dirname, path):
if os.path.isfile(path):
yield path
elif os.path.isdir(path):
for item in self.find(path):
yield item
__call__ = find
def _default_revctrl(dirname=''):
'Primary svn_cvs entry point'
for finder in finders:
for item in finder(dirname):
yield item
finders = [
re_finder('CVS/Entries', re.compile(r"^\w?/([^/]+)/", re.M)),
svn_utils.svn_finder,
]
class sdist(orig.sdist):
"""Smart sdist that finds anything supported by revision control"""
......
This diff is collapsed.
10
dir
89001
http://svn.python.org/projects/sandbox/branches/setuptools-0.6
http://svn.python.org/projects
2013-06-03T17:26:03.052972Z
89000
phillip.eby
6015fed2-1504-0410-9fe1-9d1591cc4771
api_tests.txt
file
2013-06-19T13:20:47.948712Z
dec366372ca14fbeaeb26f492bcf5725
2013-05-15T22:04:59.389374Z
88997
phillip.eby
has-props
12312
setuptools.egg-info
dir
README.txt
file
2013-06-19T13:20:47.948712Z
26f0dd5d095522ba3ad999b6b6777b92
2011-05-31T20:10:56.416725Z
88846
phillip.eby
has-props
7615
easy_install.py
file
2013-06-19T13:20:47.948712Z
97b52fe7253bf4683f9f626f015eb72e
2006-09-20T20:48:18.716070Z
51935
phillip.eby
has-props
126
setuptools
dir
launcher.c
file
2013-06-19T13:20:47.924700Z
e5a8e77de9022688b80f77fc6d742fee
2009-10-19T21:03:29.785400Z
75544
phillip.eby
has-props
7476
ez_setup.py
file
2013-06-19T13:20:47.924700Z
17e8ec5e08faccfcb08b5f8d5167ca14
2011-01-20T18:50:00.815420Z
88124
phillip.eby
has-props
8350
version
file
2013-06-19T13:20:47.924700Z
e456da09e0c9e224a56302f8316b6dbf
2007-01-09T19:21:05.921317Z
53317
phillip.eby
has-props
1143
setup.py
file
2013-06-19T13:20:47.924700Z
d4e5b3c16bd61bfef6c0bb9377a3a3ea
2013-05-15T22:04:59.389374Z
88997
phillip.eby
has-props
5228
release.sh
file
2013-06-19T13:20:47.932704Z
b1fd4054a1c107ff0f27baacd97be94c
2009-10-28T17:12:45.227140Z
75925
phillip.eby
has-props
1044
pkg_resources.txt
file
2013-06-19T13:20:47.928702Z
f497e7c92a4de207cbd9ab1943f93388
2009-10-12T20:00:02.336146Z
75385
phillip.eby
has-props
94518
site.py
file
2013-06-19T13:20:47.932704Z
ebaac6fb6525f77ca950d22e6f8315df
2006-03-11T00:39:09.666740Z
42965
phillip.eby
has-props
2362
version.dat
file
2013-06-19T13:20:47.932704Z
8e14ecea32b9874cd7d29277494554c0
2009-10-28T17:12:45.227140Z
75925
phillip.eby
has-props
80
virtual-python.py
file
2013-06-19T13:20:47.932704Z
aa857add3b5563238f0a904187f5ded9
2005-10-17T02:26:39.000000Z
41262
pje
has-props
3898
setup.cfg
file
2013-06-19T13:20:47.932704Z
eda883e744fce83f8107ad8dc8303536
2006-09-21T22:26:48.050256Z
51965
phillip.eby
has-props
296
setuptools.txt
file
2013-06-19T13:20:47.940708Z
11926256f06046b196eaf814772504e7
2013-05-15T22:04:59.389374Z
88997
phillip.eby
has-props
149832
pkg_resources.py
file
2013-06-19T13:20:47.940708Z
b63a30f5f0f0225a788c2c0e3430b3cf
2013-05-15T22:04:59.389374Z
88997
phillip.eby
has-props
90397
tests
dir
wikiup.cfg
file
2013-06-19T13:20:47.944710Z
34ad845a5e0a0b46458557fa910bf429
2008-08-21T17:23:50.797633Z
65935
phillip.eby
has-props
136
EasyInstall.txt
file
2013-06-19T13:20:47.944710Z
e97387c517f70fc18a377e42d19d64d4
2013-05-15T22:04:59.389374Z
88997
phillip.eby
has-props
82495
import os
import zipfile
import sys
import tempfile
import unittest
import shutil
import stat
import unicodedata
from subprocess import Popen as _Popen, PIPE as _PIPE
def _remove_dir(target):
#on windows this seems to a problem
for dir_path, dirs, files in os.walk(target):
os.chmod(dir_path, stat.S_IWRITE)
for filename in files:
os.chmod(os.path.join(dir_path, filename), stat.S_IWRITE)
shutil.rmtree(target)
class ZippedEnvironment(unittest.TestCase):
datafile = None
dataname = None
old_cwd = None
def setUp(self):
if self.datafile is None or self.dataname is None:
return
if not os.path.isfile(self.datafile):
self.old_cwd = None
return
self.old_cwd = os.getcwd()
self.temp_dir = tempfile.mkdtemp()
zip_file, source, target = [None, None, None]
try:
zip_file = zipfile.ZipFile(self.datafile)
for files in zip_file.namelist():
zip_file.extract(files, self.temp_dir)
finally:
if zip_file:
zip_file.close()
del zip_file
os.chdir(os.path.join(self.temp_dir, self.dataname))
def tearDown(self):
#Assume setUp was never completed
if self.dataname is None or self.datafile is None:
return
try:
if self.old_cwd:
os.chdir(self.old_cwd)
_remove_dir(self.temp_dir)
except OSError:
#sigh?
pass
def _which_dirs(cmd):
result = set()
for path in os.environ.get('PATH', '').split(os.pathsep):
......
third_party3 file:///C:/development/svn_example/repos/svn13/extra1
third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1
third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1
<?xml version="1.0" encoding="utf-8"?>
<info>
<entry
kind="dir"
path="svn13_example"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<prop-updated>2013-07-13T15:33:23.187500Z</prop-updated>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:33:28.359375Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn13_example\a file"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main/a%20file</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:33:21.109375Z</text-updated>
<checksum>a6166e5e98a5a503089cde9bc8031293</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:33:21.312500Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn13_example\to_delete"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main/to_delete</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>delete</schedule>
<text-updated>2013-07-13T15:33:28.140625Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:33:28.359375Z</date>
</commit>
</entry>
<entry
kind="dir"
path="svn13_example\folder"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main/folder</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<prop-updated>2013-07-13T15:33:26.187500Z</prop-updated>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:33:26.312500Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn13_example\folder\quest.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main/folder/quest.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:33:20.109375Z</text-updated>
<checksum>795240c6a830c14f83961e57e07dad12</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:33:20.312500Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn13_example\folder\lalala.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn13/main/folder/lalala.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn13/main</root>
<uuid>d2996769-47b0-9946-b618-da1aa3eceda3</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:33:19.375000Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:33:19.609375Z</date>
</commit>
</entry>
</info>
third_party3 file:///C:/development/svn_example/repos/svn13/extra1
third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1
third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1
<?xml version="1.0"?>
<info>
<entry
kind="dir"
path="svn14_example"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:34:14.406250Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn14_example\a file"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main/a%20file</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:34:08.109375Z</text-updated>
<checksum>a6166e5e98a5a503089cde9bc8031293</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:34:08.390625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn14_example\to_delete"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main/to_delete</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>delete</schedule>
<text-updated>2013-07-13T15:34:14.125000Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:34:14.406250Z</date>
</commit>
</entry>
<entry
kind="dir"
path="svn14_example\folder"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main/folder</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:34:12.390625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn14_example\folder\quest.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main/folder/quest.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:34:07.109375Z</text-updated>
<checksum>795240c6a830c14f83961e57e07dad12</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:34:07.390625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn14_example\folder\lalala.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn14/main/folder/lalala.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn14/main</root>
<uuid>c75942e5-8b7a-354d-b1cf-73dee23fa94f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<text-updated>2013-07-13T15:34:06.250000Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:34:06.531250Z</date>
</commit>
</entry>
</info>
third_party3 file:///C:/development/svn_example/repos/svn15/extra1
-r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2
file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party
<?xml version="1.0"?>
<properties>
<target
path="C:/development/svn_example/svn15_example/folder">
<property
name="svn:externals">third_party3 file:///C:/development/svn_example/repos/svn15/extra2
-r3 file:///C:/development/svn_example/repos/svn15/extra2 third_party2
file:///C:/development/svn_example/repos/svn15/extra2@r1 third_party大介
</property>
</target>
<target
path="C:/development/svn_example/svn15_example">
<property
name="svn:externals">third_party3 file:///C:/development/svn_example/repos/svn15/extra1
-r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2
file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party大介
</property>
</target>
</properties>
<?xml version="1.0"?>
<info>
<entry
kind="dir"
path="svn15_example"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:34:49.562500Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn15_example\a file"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main/a%20file</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:34:43.109375Z</text-updated>
<checksum>a6166e5e98a5a503089cde9bc8031293</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:34:43.484375Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn15_example\to_delete"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main/to_delete</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>delete</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:34:49.125000Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:34:49.562500Z</date>
</commit>
</entry>
<entry
kind="dir"
path="svn15_example\folder"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main/folder</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:34:47.515625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn15_example\folder\quest.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main/folder/quest.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:34:42.109375Z</text-updated>
<checksum>795240c6a830c14f83961e57e07dad12</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:34:42.484375Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn15_example\folder\lalala.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn15/main/folder/lalala.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn15/main</root>
<uuid>4eab6983-54fe-384b-a282-9306f52d948f</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:34:41.375000Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:34:41.734375Z</date>
</commit>
</entry>
</info>
"third party3" file:///C:/development/svn_example/repos/svn16/extra1
'third party3b' file:///C:/development/svn_example/repos/svn16/extra1
-r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party
<?xml version="1.0"?>
<properties>
<target
path="C:/development/svn_example/svn16_example/folder">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn16/extra2
-r3 file:///C:/development/svn_example/repos/svn16/extra2 third\ party2
file:///C:/development/svn_example/repos/svn16/extra2@r1 third_party大介
</property>
</target>
<target
path="C:/development/svn_example/svn16_example">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn16/extra1
-r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
</property>
</target>
</properties>
<?xml version="1.0"?>
<info>
<entry
kind="dir"
path="svn16_example"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:17.390625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn16_example\a file"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main/a%20file</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:14.578125Z</text-updated>
<checksum>a6166e5e98a5a503089cde9bc8031293</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:35:14.906250Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn16_example\to_delete"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main/to_delete</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>delete</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:17.046875Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:17.390625Z</date>
</commit>
</entry>
<entry
kind="dir"
path="svn16_example\folder"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main/folder</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:35:16.406250Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn16_example\folder\quest.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main/folder/quest.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:14.078125Z</text-updated>
<checksum>795240c6a830c14f83961e57e07dad12</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:35:14.421875Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn16_example\folder\lalala.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn16/main/folder/lalala.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn16/main</root>
<uuid>bd8d2cfc-1a74-de45-b166-262010c17c0a</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:12.171875Z</text-updated>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:35:13.906250Z</date>
</commit>
</entry>
</info>
"third party3" file:///C:/development/svn_example/repos/svn17/extra1
'third party3b' file:///C:/development/svn_example/repos/svn17/extra1
-r3 file:///C:/development/svn_example/repos/svn17/extra1 third\ party2
file:///C:/development/svn_example/repos/svn17/extra1@r1 third_party
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<target
path="C:/development/svn_example/svn17_example">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn16/extra1
-r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
</property>
</target>
<target
path="C:/development/svn_example/svn17_example/folder">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn17/extra2
-r3 file:///C:/development/svn_example/repos/svn17/extra2 third\ party2
file:///C:/development/svn_example/repos/svn17/extra2@r1 third_party大介
</property>
</target>
</properties>
<?xml version="1.0" encoding="UTF-8"?>
<info>
<entry
kind="dir"
path="svn17_example"
revision="6">
<url>file:///C:/development/svn_example/repos/svn17/main</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:36.171875Z</date>
</commit>
</entry>
<entry
path="svn17_example\folder"
revision="6"
kind="dir">
<url>file:///C:/development/svn_example/repos/svn17/main/folder</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:35:34.859375Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn17_example\folder\quest.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn17/main/folder/quest.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:32.812500Z</text-updated>
<checksum>bc80eba9e7a10c0a571a4678c520bc9683f3bac2</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:35:33.109375Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn17_example\folder\lalala.txt"
revision="6">
<url>file:///C:/development/svn_example/repos/svn17/main/folder/lalala.txt</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:32.343750Z</text-updated>
<checksum>da39a3ee5e6b4b0d3255bfef95601890afd80709</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:35:32.687500Z</date>
</commit>
</entry>
<entry
path="svn17_example\a file"
revision="6"
kind="file">
<url>file:///C:/development/svn_example/repos/svn17/main/a%20file</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:33.187500Z</text-updated>
<checksum>43785ab4b1816b49f242990883292813cd4f486c</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:35:33.515625Z</date>
</commit>
</entry>
<entry
path="svn17_example\to_delete"
revision="6"
kind="file">
<url>file:///C:/development/svn_example/repos/svn17/main/to_delete</url>
<repository>
<root>file:///C:/development/svn_example/repos/svn17/main</root>
<uuid>5ba45434-5197-164e-afab-81923f4744f5</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn17_example</wcroot-abspath>
<schedule>delete</schedule>
<depth>infinity</depth>
<checksum>da39a3ee5e6b4b0d3255bfef95601890afd80709</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:36.171875Z</date>
</commit>
</entry>
</info>
"third party3" file:///C:/development/svn_example/repos/svn18/extra1
'third party3b' file:///C:/development/svn_example/repos/svn18/extra1
-r3 file:///C:/development/svn_example/repos/svn18/extra1 third\ party2
file:///C:/development/svn_example/repos/svn18/extra1@r1 third_party
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<target
path="C:/development/svn_example/svn18_example">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn16/extra1
-r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
</property>
</target>
<target
path="C:/development/svn_example/svn18_example/folder">
<property
name="svn:externals">"third party3" file:///C:/development/svn_example/repos/svn18/extra2
-r3 file:///C:/development/svn_example/repos/svn18/extra2 third\ party2
file:///C:/development/svn_example/repos/svn18/extra2@r1 third_party大介
</property>
</target>
</properties>
<?xml version="1.0" encoding="UTF-8"?>
<info>
<entry
path="svn18_example"
revision="6"
kind="dir">
<url>file:///C:/development/svn_example/repos/svn18/main</url>
<relative-url>^/</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:57.796875Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn18_example\a file"
revision="6">
<url>file:///C:/development/svn_example/repos/svn18/main/a%20file</url>
<relative-url>^/a%20file</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:54.906250Z</text-updated>
<checksum>43785ab4b1816b49f242990883292813cd4f486c</checksum>
</wc-info>
<commit
revision="3">
<author>ptt</author>
<date>2013-07-13T15:35:55.265625Z</date>
</commit>
</entry>
<entry
kind="file"
path="svn18_example\to_delete"
revision="6">
<url>file:///C:/development/svn_example/repos/svn18/main/to_delete</url>
<relative-url>^/to_delete</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>delete</schedule>
<depth>infinity</depth>
<checksum>da39a3ee5e6b4b0d3255bfef95601890afd80709</checksum>
</wc-info>
<commit
revision="6">
<author>ptt</author>
<date>2013-07-13T15:35:57.796875Z</date>
</commit>
</entry>
<entry
kind="dir"
path="svn18_example\folder"
revision="6">
<url>file:///C:/development/svn_example/repos/svn18/main/folder</url>
<relative-url>^/folder</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
revision="5">
<author>ptt</author>
<date>2013-07-13T15:35:56.750000Z</date>
</commit>
</entry>
<entry
path="svn18_example\folder\quest.txt"
revision="6"
kind="file">
<url>file:///C:/development/svn_example/repos/svn18/main/folder/quest.txt</url>
<relative-url>^/folder/quest.txt</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:54.484375Z</text-updated>
<checksum>bc80eba9e7a10c0a571a4678c520bc9683f3bac2</checksum>
</wc-info>
<commit
revision="2">
<author>ptt</author>
<date>2013-07-13T15:35:54.843750Z</date>
</commit>
</entry>
<entry
path="svn18_example\folder\lalala.txt"
revision="6"
kind="file">
<url>file:///C:/development/svn_example/repos/svn18/main/folder/lalala.txt</url>
<relative-url>^/folder/lalala.txt</relative-url>
<repository>
<root>file:///C:/development/svn_example/repos/svn18/main</root>
<uuid>3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9</uuid>
</repository>
<wc-info>
<wcroot-abspath>C:/development/svn_example/svn18_example</wcroot-abspath>
<schedule>normal</schedule>
<depth>infinity</depth>
<text-updated>2013-07-13T15:35:54.015625Z</text-updated>
<checksum>da39a3ee5e6b4b0d3255bfef95601890afd80709</checksum>
</wc-info>
<commit
revision="1">
<author>ptt</author>
<date>2013-07-13T15:35:54.375000Z</date>
</commit>
</entry>
</info>
import distutils.core
import os
import sys
import tempfile
import shutil
import stat
import unittest
import pkg_resources
import warnings
from setuptools.command import egg_info
from setuptools import svn_utils
from setuptools.tests import environment, test_svn
from setuptools.tests.py26compat import skipIf
ENTRIES_V10 = pkg_resources.resource_string(__name__, 'entries-v10')
"An entries file generated with svn 1.6.17 against the legacy Setuptools repo"
from . import environment
class TestEggInfo(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
os.mkdir(os.path.join(self.test_dir, '.svn'))
self.old_cwd = os.getcwd()
os.chdir(self.test_dir)
......@@ -31,12 +19,6 @@ class TestEggInfo(unittest.TestCase):
os.chdir(self.old_cwd)
shutil.rmtree(self.test_dir)
def _write_entries(self, entries):
fn = os.path.join(self.test_dir, '.svn', 'entries')
entries_f = open(fn, 'wb')
entries_f.write(entries)
entries_f.close()
def _create_project(self):
with open('setup.py', 'w') as f:
f.write('from setuptools import setup\n')
......@@ -51,52 +33,6 @@ class TestEggInfo(unittest.TestCase):
f.write('def run():\n')
f.write(" print('hello')\n")
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_version_10_format(self):
"""
"""
#keeping this set for 1.6 is a good check on the get_svn_revision
#to ensure I return using svnversion what would had been returned
version_str = svn_utils.SvnInfo.get_svn_version()
version = [int(x) for x in version_str.split('.')[:2]]
if version != [1, 6]:
if hasattr(self, 'skipTest'):
self.skipTest('')
else:
sys.stderr.write('\n Skipping due to SVN Version\n')
return
self._write_entries(ENTRIES_V10)
rev = egg_info.egg_info.get_svn_revision()
self.assertEqual(rev, '89000')
def test_version_10_format_legacy_parser(self):
"""
"""
path_variable = None
for env in os.environ:
if env.lower() == 'path':
path_variable = env
if path_variable:
old_path = os.environ[path_variable]
os.environ[path_variable] = ''
#catch_warnings not available until py26
warning_filters = warnings.filters
warnings.filters = warning_filters[:]
try:
warnings.simplefilter("ignore", DeprecationWarning)
self._write_entries(ENTRIES_V10)
rev = egg_info.egg_info.get_svn_revision()
finally:
#restore the warning filters
warnings.filters = warning_filters
#restore the os path
if path_variable:
os.environ[path_variable] = old_path
self.assertEqual(rev, '89000')
def test_egg_base_installed_egg_info(self):
self._create_project()
temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
......@@ -139,130 +75,5 @@ class TestEggInfo(unittest.TestCase):
shutil.rmtree(temp_dir)
DUMMY_SOURCE_TXT = """CHANGES.txt
CONTRIBUTORS.txt
HISTORY.txt
LICENSE
MANIFEST.in
README.txt
setup.py
dummy/__init__.py
dummy/test.txt
dummy.egg-info/PKG-INFO
dummy.egg-info/SOURCES.txt
dummy.egg-info/dependency_links.txt
dummy.egg-info/top_level.txt"""
class TestSvnDummy(environment.ZippedEnvironment):
def setUp(self):
version = svn_utils.SvnInfo.get_svn_version()
if not version: # None or Empty
return None
self.base_version = tuple([int(x) for x in version.split('.')][:2])
if not self.base_version:
raise ValueError('No SVN tools installed')
elif self.base_version < (1, 3):
raise ValueError('Insufficient SVN Version %s' % version)
elif self.base_version >= (1, 9):
#trying the latest version
self.base_version = (1, 8)
self.dataname = "dummy%i%i" % self.base_version
self.datafile = os.path.join('setuptools', 'tests',
'svn_data', self.dataname + ".zip")
super(TestSvnDummy, self).setUp()
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_sources(self):
code, data = environment.run_setup_py(["sdist"],
pypath=self.old_cwd,
data_stream=1)
if code:
raise AssertionError(data)
sources = os.path.join('dummy.egg-info', 'SOURCES.txt')
infile = open(sources, 'r')
try:
read_contents = infile.read()
finally:
infile.close()
del infile
self.assertEqual(DUMMY_SOURCE_TXT, read_contents)
return data
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_svn_tags(self):
code, data = environment.run_setup_py(["egg_info",
"--tag-svn-revision"],
pypath=self.old_cwd,
data_stream=1)
if code:
raise AssertionError(data)
pkginfo = os.path.join('dummy.egg-info', 'PKG-INFO')
infile = open(pkginfo, 'r')
try:
read_contents = infile.readlines()
finally:
infile.close()
del infile
self.assertTrue("Version: 0.1.1.post1\n" in read_contents)
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_no_tags(self):
code, data = environment.run_setup_py(["egg_info"],
pypath=self.old_cwd,
data_stream=1)
if code:
raise AssertionError(data)
pkginfo = os.path.join('dummy.egg-info', 'PKG-INFO')
infile = open(pkginfo, 'r')
try:
read_contents = infile.readlines()
finally:
infile.close()
del infile
self.assertTrue("Version: 0.1.1\n" in read_contents)
class TestSvnDummyLegacy(environment.ZippedEnvironment):
def setUp(self):
self.base_version = (1, 6)
self.dataname = "dummy%i%i" % self.base_version
self.datafile = os.path.join('setuptools', 'tests',
'svn_data', self.dataname + ".zip")
super(TestSvnDummyLegacy, self).setUp()
def test_sources(self):
code, data = environment.run_setup_py(["sdist"],
pypath=self.old_cwd,
path="",
data_stream=1)
if code:
raise AssertionError(data)
sources = os.path.join('dummy.egg-info', 'SOURCES.txt')
infile = open(sources, 'r')
try:
read_contents = infile.read()
finally:
infile.close()
del infile
self.assertEqual(DUMMY_SOURCE_TXT, read_contents)
return data
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)
......@@ -8,16 +8,13 @@ import sys
import tempfile
import unittest
import unicodedata
import re
import contextlib
from setuptools.tests import environment, test_svn
from setuptools.tests.py26compat import skipIf
from setuptools.compat import StringIO, unicode, PY3, PY2
from setuptools.command.sdist import sdist, walk_revctrl
from setuptools.command.sdist import sdist
from setuptools.command.egg_info import manifest_maker
from setuptools.dist import Distribution
from setuptools import svn_utils
SETUP_ATTRS = {
'name': 'sdist_test',
......@@ -418,135 +415,6 @@ class TestSdistTest(unittest.TestCase):
except UnicodeDecodeError:
self.assertFalse(filename in cmd.filelist.files)
class TestDummyOutput(environment.ZippedEnvironment):
def setUp(self):
self.datafile = os.path.join('setuptools', 'tests',
'svn_data', "dummy.zip")
self.dataname = "dummy"
super(TestDummyOutput, self).setUp()
def _run(self):
code, data = environment.run_setup_py(["sdist"],
pypath=self.old_cwd,
data_stream=0)
if code:
info = "DIR: " + os.path.abspath('.')
info += "\n SDIST RETURNED: %i\n\n" % code
info += data
raise AssertionError(info)
datalines = data.splitlines()
possible = (
"running sdist",
"running egg_info",
"creating dummy\.egg-info",
"writing dummy\.egg-info",
"writing top-level names to dummy\.egg-info",
"writing dependency_links to dummy\.egg-info",
"writing manifest file 'dummy\.egg-info",
"reading manifest file 'dummy\.egg-info",
"reading manifest template 'MANIFEST\.in'",
"writing manifest file 'dummy\.egg-info",
"creating dummy-0.1.1",
"making hard links in dummy-0\.1\.1",
"copying files to dummy-0\.1\.1",
"copying \S+ -> dummy-0\.1\.1",
"copying dummy",
"copying dummy\.egg-info",
"hard linking \S+ -> dummy-0\.1\.1",
"hard linking dummy",
"hard linking dummy\.egg-info",
"Writing dummy-0\.1\.1",
"creating dist",
"creating 'dist",
"Creating tar archive",
"running check",
"adding 'dummy-0\.1\.1",
"tar .+ dist/dummy-0\.1\.1\.tar dummy-0\.1\.1",
"gzip .+ dist/dummy-0\.1\.1\.tar",
"removing 'dummy-0\.1\.1' \\(and everything under it\\)",
)
print(" DIR: " + os.path.abspath('.'))
for line in datalines:
found = False
for pattern in possible:
if re.match(pattern, line):
print(" READ: " + line)
found = True
break
if not found:
raise AssertionError("Unexpexected: %s\n-in-\n%s"
% (line, data))
return data
def test_sources(self):
self._run()
class TestSvn(environment.ZippedEnvironment):
def setUp(self):
version = svn_utils.SvnInfo.get_svn_version()
if not version: # None or Empty
return
self.base_version = tuple([int(x) for x in version.split('.')][:2])
if not self.base_version:
raise ValueError('No SVN tools installed')
elif self.base_version < (1, 3):
raise ValueError('Insufficient SVN Version %s' % version)
elif self.base_version >= (1, 9):
# trying the latest version
self.base_version = (1, 8)
self.dataname = "svn%i%i_example" % self.base_version
self.datafile = os.path.join('setuptools', 'tests',
'svn_data', self.dataname + ".zip")
super(TestSvn, self).setUp()
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_walksvn(self):
if self.base_version >= (1, 6):
folder2 = 'third party2'
folder3 = 'third party3'
else:
folder2 = 'third_party2'
folder3 = 'third_party3'
# TODO is this right
expected = set([
os.path.join('a file'),
os.path.join(folder2, 'Changes.txt'),
os.path.join(folder2, 'MD5SUMS'),
os.path.join(folder2, 'README.txt'),
os.path.join(folder3, 'Changes.txt'),
os.path.join(folder3, 'MD5SUMS'),
os.path.join(folder3, 'README.txt'),
os.path.join(folder3, 'TODO.txt'),
os.path.join(folder3, 'fin'),
os.path.join('third_party', 'README.txt'),
os.path.join('folder', folder2, 'Changes.txt'),
os.path.join('folder', folder2, 'MD5SUMS'),
os.path.join('folder', folder2, 'WatashiNiYomimasu.txt'),
os.path.join('folder', folder3, 'Changes.txt'),
os.path.join('folder', folder3, 'fin'),
os.path.join('folder', folder3, 'MD5SUMS'),
os.path.join('folder', folder3, 'oops'),
os.path.join('folder', folder3, 'WatashiNiYomimasu.txt'),
os.path.join('folder', folder3, 'ZuMachen.txt'),
os.path.join('folder', 'third_party', 'WatashiNiYomimasu.txt'),
os.path.join('folder', 'lalala.txt'),
os.path.join('folder', 'quest.txt'),
# The example will have a deleted file
# (or should) but shouldn't return it
])
self.assertEqual(set(x for x in walk_revctrl()), expected)
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)
# -*- coding: utf-8 -*-
"""svn tests"""
import io
import os
import subprocess
import sys
import unittest
from setuptools.tests import environment
from setuptools.compat import unicode, unichr
from setuptools import svn_utils
from setuptools.tests.py26compat import skipIf
def _do_svn_check():
try:
subprocess.check_call(["svn", "--version"],
shell=(sys.platform == 'win32'))
return True
except (OSError, subprocess.CalledProcessError):
return False
_svn_check = _do_svn_check()
class TestSvnVersion(unittest.TestCase):
def test_no_svn_found(self):
path_variable = None
for env in os.environ:
if env.lower() == 'path':
path_variable = env
if path_variable is None:
try:
self.skipTest('Cannot figure out how to modify path')
except AttributeError: # PY26 doesn't have this
return
old_path = os.environ[path_variable]
os.environ[path_variable] = ''
try:
version = svn_utils.SvnInfo.get_svn_version()
self.assertEqual(version, '')
finally:
os.environ[path_variable] = old_path
@skipIf(not _svn_check, "No SVN to text, in the first place")
def test_svn_should_exist(self):
version = svn_utils.SvnInfo.get_svn_version()
self.assertNotEqual(version, '')
def _read_utf8_file(path):
fileobj = None
try:
fileobj = io.open(path, 'r', encoding='utf-8')
data = fileobj.read()
return data
finally:
if fileobj:
fileobj.close()
class ParserInfoXML(unittest.TestCase):
def parse_tester(self, svn_name, ext_spaces):
path = os.path.join('setuptools', 'tests',
'svn_data', svn_name + '_info.xml')
#Remember these are pre-generated to test XML parsing
# so these paths might not valid on your system
example_base = "%s_example" % svn_name
data = _read_utf8_file(path)
expected = set([
("\\".join((example_base, 'a file')), 'file'),
("\\".join((example_base, 'folder')), 'dir'),
("\\".join((example_base, 'folder', 'lalala.txt')), 'file'),
("\\".join((example_base, 'folder', 'quest.txt')), 'file'),
])
self.assertEqual(set(x for x in svn_utils.parse_dir_entries(data)),
expected)
def test_svn13(self):
self.parse_tester('svn13', False)
def test_svn14(self):
self.parse_tester('svn14', False)
def test_svn15(self):
self.parse_tester('svn15', False)
def test_svn16(self):
self.parse_tester('svn16', True)
def test_svn17(self):
self.parse_tester('svn17', True)
def test_svn18(self):
self.parse_tester('svn18', True)
class ParserExternalXML(unittest.TestCase):
def parse_tester(self, svn_name, ext_spaces):
path = os.path.join('setuptools', 'tests',
'svn_data', svn_name + '_ext_list.xml')
example_base = svn_name + '_example'
data = _read_utf8_file(path)
if ext_spaces:
folder2 = 'third party2'
folder3 = 'third party3'
else:
folder2 = 'third_party2'
folder3 = 'third_party3'
expected = set([
os.sep.join((example_base, folder2)),
os.sep.join((example_base, folder3)),
# folder is third_party大介
os.sep.join((example_base,
unicode('third_party') +
unichr(0x5927) + unichr(0x4ecb))),
os.sep.join((example_base, 'folder', folder2)),
os.sep.join((example_base, 'folder', folder3)),
os.sep.join((example_base, 'folder',
unicode('third_party') +
unichr(0x5927) + unichr(0x4ecb))),
])
expected = set(os.path.normpath(x) for x in expected)
dir_base = os.sep.join(('C:', 'development', 'svn_example'))
self.assertEqual(set(x for x
in svn_utils.parse_externals_xml(data, dir_base)), expected)
def test_svn15(self):
self.parse_tester('svn15', False)
def test_svn16(self):
self.parse_tester('svn16', True)
def test_svn17(self):
self.parse_tester('svn17', True)
def test_svn18(self):
self.parse_tester('svn18', True)
class ParseExternal(unittest.TestCase):
def parse_tester(self, svn_name, ext_spaces):
path = os.path.join('setuptools', 'tests',
'svn_data', svn_name + '_ext_list.txt')
data = _read_utf8_file(path)
if ext_spaces:
expected = set(['third party2', 'third party3',
'third party3b', 'third_party'])
else:
expected = set(['third_party2', 'third_party3', 'third_party'])
self.assertEqual(set(x for x in svn_utils.parse_external_prop(data)),
expected)
def test_svn13(self):
self.parse_tester('svn13', False)
def test_svn14(self):
self.parse_tester('svn14', False)
def test_svn15(self):
self.parse_tester('svn15', False)
def test_svn16(self):
self.parse_tester('svn16', True)
def test_svn17(self):
self.parse_tester('svn17', True)
def test_svn18(self):
self.parse_tester('svn18', True)
class TestSvn(environment.ZippedEnvironment):
def setUp(self):
version = svn_utils.SvnInfo.get_svn_version()
if not version: # empty or null
self.dataname = None
self.datafile = None
return
self.base_version = tuple([int(x) for x in version.split('.')[:2]])
if self.base_version < (1,3):
raise ValueError('Insufficient SVN Version %s' % version)
elif self.base_version >= (1,9):
#trying the latest version
self.base_version = (1,8)
self.dataname = "svn%i%i_example" % self.base_version
self.datafile = os.path.join('setuptools', 'tests',
'svn_data', self.dataname + ".zip")
super(TestSvn, self).setUp()
@skipIf(not _svn_check, "No SVN to text, in the first place")
def test_revision(self):
rev = svn_utils.SvnInfo.load('.').get_revision()
self.assertEqual(rev, 6)
@skipIf(not _svn_check, "No SVN to text, in the first place")
def test_entries(self):
expected = set([
(os.path.join('a file'), 'file'),
(os.path.join('folder'), 'dir'),
(os.path.join('folder', 'lalala.txt'), 'file'),
(os.path.join('folder', 'quest.txt'), 'file'),
#The example will have a deleted file (or should)
#but shouldn't return it
])
info = svn_utils.SvnInfo.load('.')
self.assertEqual(set(x for x in info.entries), expected)
@skipIf(not _svn_check, "No SVN to text, in the first place")
def test_externals(self):
if self.base_version >= (1,6):
folder2 = 'third party2'
folder3 = 'third party3'
else:
folder2 = 'third_party2'
folder3 = 'third_party3'
expected = set([
os.path.join(folder2),
os.path.join(folder3),
os.path.join('third_party'),
os.path.join('folder', folder2),
os.path.join('folder', folder3),
os.path.join('folder', 'third_party'),
])
info = svn_utils.SvnInfo.load('.')
self.assertEqual(set([x for x in info.externals]), expected)
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)
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