Hello community,
here is the log from the commit of package python-setuptools_scm for
openSUSE:Factory checked in at 2018-05-19 15:40:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-setuptools_scm (Old)
and /work/SRC/openSUSE:Factory/.python-setuptools_scm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-setuptools_scm"
Sat May 19 15:40:33 2018 rev:14 rq:607411 version:2.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-setuptools_scm/python-setuptools_scm.changes
2018-04-22 14:29:44.054476229 +0200
+++
/work/SRC/openSUSE:Factory/.python-setuptools_scm.new/python-setuptools_scm.changes
2018-05-19 15:40:57.237947495 +0200
@@ -1,0 +2,9 @@
+Tue May 15 05:50:53 UTC 2018 - [email protected]
+
+- update to version 2.1.0:
+ * enhance docs for sphinx usage
+ * add symlink support to file finder for git #247 (thanks Stéphane
+ Bidoul)
+ * enhance tests handling win32 (thanks Stéphane Bidoul)
+
+-------------------------------------------------------------------
Old:
----
setuptools_scm-2.0.0.tar.gz
New:
----
setuptools_scm-2.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-setuptools_scm.spec ++++++
--- /var/tmp/diff_new_pack.JKhfIS/_old 2018-05-19 15:41:00.001846371 +0200
+++ /var/tmp/diff_new_pack.JKhfIS/_new 2018-05-19 15:41:00.005846225 +0200
@@ -19,12 +19,12 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_with test
Name: python-setuptools_scm
-Version: 2.0.0
+Version: 2.1.0
Release: 0
Summary: Manage your versions by scm tags
License: MIT
Group: Development/Languages/Python
-Url: https://github.com/pypa/setuptools_scm
+URL: https://github.com/pypa/setuptools_scm
Source:
https://files.pythonhosted.org/packages/source/s/setuptools_scm/setuptools_scm-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
++++++ setuptools_scm-2.0.0.tar.gz -> setuptools_scm-2.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/CHANGELOG.rst
new/setuptools_scm-2.1.0/CHANGELOG.rst
--- old/setuptools_scm-2.0.0/CHANGELOG.rst 2018-04-10 10:27:36.000000000
+0200
+++ new/setuptools_scm-2.1.0/CHANGELOG.rst 2018-05-13 10:55:37.000000000
+0200
@@ -1,3 +1,12 @@
+v2.1.0
+======
+
+* enhance docs for sphinx usage
+* add symlink support to file finder for git #247
+ (thanks Stéphane Bidoul)
+* enhance tests handling win32
+ (thanks Stéphane Bidoul)
+
v2.0.0
========
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/PKG-INFO
new/setuptools_scm-2.1.0/PKG-INFO
--- old/setuptools_scm-2.0.0/PKG-INFO 2018-04-10 10:28:15.000000000 +0200
+++ new/setuptools_scm-2.1.0/PKG-INFO 2018-05-13 10:56:03.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: setuptools_scm
-Version: 2.0.0
+Version: 2.1.0
Summary: the blessed package to manage your versions by scm tags
Home-page: https://github.com/pypa/setuptools_scm/
Author: Ronny Pfannschmidt
@@ -88,6 +88,7 @@
.. code:: python
+ # contents of docs/conf.py
from pkg_resources import get_distribution
release = get_distribution('myproject').version
# for example take major/minor
@@ -292,12 +293,21 @@
.. code:: python
+ # content of setup.py
+ import setuptools
+
def myversion():
from setuptools_scm.version import get_local_dirty_tag
def clean_scheme(version):
return get_local_dirty_tag(version) if version.dirty else
'+clean'
return {'local_scheme': clean_scheme}
+
+ setup(
+ ...,
+ use_scm_version=myversion,
+ ...
+ )
Code of Conduct
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/README.rst
new/setuptools_scm-2.1.0/README.rst
--- old/setuptools_scm-2.0.0/README.rst 2018-04-10 10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/README.rst 2018-05-13 10:55:37.000000000 +0200
@@ -80,6 +80,7 @@
.. code:: python
+ # contents of docs/conf.py
from pkg_resources import get_distribution
release = get_distribution('myproject').version
# for example take major/minor
@@ -284,12 +285,21 @@
.. code:: python
+ # content of setup.py
+ import setuptools
+
def myversion():
from setuptools_scm.version import get_local_dirty_tag
def clean_scheme(version):
return get_local_dirty_tag(version) if version.dirty else '+clean'
return {'local_scheme': clean_scheme}
+
+ setup(
+ ...,
+ use_scm_version=myversion,
+ ...
+ )
Code of Conduct
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/setup.py
new/setuptools_scm-2.1.0/setup.py
--- old/setuptools_scm-2.0.0/setup.py 2018-04-10 10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/setup.py 2018-05-13 10:55:37.000000000 +0200
@@ -81,8 +81,8 @@
pip-egg-info = setuptools_scm.hacks:parse_pip_egg_info
[setuptools_scm.files_command]
- .hg = setuptools_scm.hg:FILES_COMMAND
- .git = setuptools_scm.git:list_files_in_archive
+ .hg = setuptools_scm.file_finder_hg:hg_find_files
+ .git = setuptools_scm.file_finder_git:git_find_files
[setuptools_scm.version_scheme]
guess-next-dev = setuptools_scm.version:guess_next_dev_version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/setuptools_scm/file_finder.py
new/setuptools_scm-2.1.0/setuptools_scm/file_finder.py
--- old/setuptools_scm-2.0.0/setuptools_scm/file_finder.py 1970-01-01
01:00:00.000000000 +0100
+++ new/setuptools_scm-2.1.0/setuptools_scm/file_finder.py 2018-05-13
10:55:37.000000000 +0200
@@ -0,0 +1,56 @@
+import os
+
+
+def scm_find_files(path, scm_files, scm_dirs):
+ """ setuptools compatible file finder that follows symlinks
+
+ - path: the root directory from which to search
+ - scm_files: set of scm controlled files and symlinks
+ (including symlinks to directories)
+ - scm_dirs: set of scm controlled directories
+ (including directories containing no scm controlled files)
+
+ scm_files and scm_dirs must be absolute with symlinks resolved (realpath),
+ with normalized case (normcase)
+
+ Spec here: http://setuptools.readthedocs.io/en/latest/setuptools.html#\
+ adding-support-for-revision-control-systems
+ """
+ realpath = os.path.normcase(os.path.realpath(path))
+ seen = set()
+ res = []
+ for dirpath, dirnames, filenames in os.walk(realpath, followlinks=True):
+ # dirpath with symlinks resolved
+ realdirpath = os.path.normcase(os.path.realpath(dirpath))
+
+ def _link_not_in_scm(n):
+ fn = os.path.join(realdirpath, os.path.normcase(n))
+ return os.path.islink(fn) and fn not in scm_files
+
+ if realdirpath not in scm_dirs:
+ # directory not in scm, don't walk it's content
+ dirnames[:] = []
+ continue
+ if os.path.islink(dirpath) and \
+ not os.path.relpath(realdirpath,
realpath).startswith(os.pardir):
+ # a symlink to a directory not outside path:
+ # we keep it in the result and don't walk its content
+ res.append(
+ os.path.join(path, os.path.relpath(dirpath, path)))
+ dirnames[:] = []
+ continue
+ if realdirpath in seen:
+ # symlink loop protection
+ dirnames[:] = []
+ continue
+ dirnames[:] = [dn for dn in dirnames if not _link_not_in_scm(dn)]
+ for filename in filenames:
+ if _link_not_in_scm(filename):
+ continue
+ # dirpath + filename with symlinks preserved
+ fullfilename = os.path.join(dirpath, filename)
+ if os.path.normcase(os.path.realpath(fullfilename)) in scm_files:
+ res.append(
+ os.path.join(path, os.path.relpath(fullfilename, path)))
+ seen.add(realdirpath)
+ return res
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/setuptools_scm/file_finder_git.py
new/setuptools_scm-2.1.0/setuptools_scm/file_finder_git.py
--- old/setuptools_scm-2.0.0/setuptools_scm/file_finder_git.py 1970-01-01
01:00:00.000000000 +0100
+++ new/setuptools_scm-2.1.0/setuptools_scm/file_finder_git.py 2018-05-13
10:55:37.000000000 +0200
@@ -0,0 +1,45 @@
+import os
+import subprocess
+import tarfile
+
+from .file_finder import scm_find_files
+
+
+def _git_toplevel(path):
+ try:
+ with open(os.devnull, 'wb') as devnull:
+ out = subprocess.check_output([
+ 'git', 'rev-parse', '--show-toplevel',
+ ], cwd=(path or '.'), universal_newlines=True, stderr=devnull)
+ return os.path.normcase(os.path.realpath(out.strip()))
+ except subprocess.CalledProcessError:
+ # git returned error, we are not in a git repo
+ return None
+ except OSError:
+ # git command not found, probably
+ return None
+
+
+def _git_ls_files_and_dirs(toplevel):
+ # use git archive instead of git ls-file to honor
+ # export-ignore git attribute
+ cmd = ['git', 'archive', '--prefix', toplevel + os.path.sep, 'HEAD']
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=toplevel)
+ tf = tarfile.open(fileobj=proc.stdout, mode='r|*')
+ git_files = set()
+ git_dirs = set([toplevel])
+ for member in tf.getmembers():
+ name = os.path.normcase(member.name).replace('/', os.path.sep)
+ if member.type == tarfile.DIRTYPE:
+ git_dirs.add(name)
+ else:
+ git_files.add(name)
+ return git_files, git_dirs
+
+
+def git_find_files(path=''):
+ toplevel = _git_toplevel(path)
+ if not toplevel:
+ return []
+ git_files, git_dirs = _git_ls_files_and_dirs(toplevel)
+ return scm_find_files(path, git_files, git_dirs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/setuptools_scm/file_finder_hg.py
new/setuptools_scm-2.1.0/setuptools_scm/file_finder_hg.py
--- old/setuptools_scm-2.0.0/setuptools_scm/file_finder_hg.py 1970-01-01
01:00:00.000000000 +0100
+++ new/setuptools_scm-2.1.0/setuptools_scm/file_finder_hg.py 2018-05-13
10:55:37.000000000 +0200
@@ -0,0 +1,44 @@
+import os
+import subprocess
+
+from .file_finder import scm_find_files
+
+
+def _hg_toplevel(path):
+ try:
+ with open(os.devnull, 'wb') as devnull:
+ out = subprocess.check_output([
+ 'hg', 'root',
+ ], cwd=(path or '.'), universal_newlines=True, stderr=devnull)
+ return os.path.normcase(os.path.realpath(out.strip()))
+ except subprocess.CalledProcessError:
+ # hg returned error, we are not in a mercurial repo
+ return None
+ except OSError:
+ # hg command not found, probably
+ return None
+
+
+def _hg_ls_files_and_dirs(toplevel):
+ hg_files = set()
+ hg_dirs = set([toplevel])
+ out = subprocess.check_output([
+ 'hg', 'files',
+ ], cwd=toplevel, universal_newlines=True)
+ for name in out.splitlines():
+ name = os.path.normcase(name).replace('/', os.path.sep)
+ fullname = os.path.join(toplevel, name)
+ hg_files.add(fullname)
+ dirname = os.path.dirname(fullname)
+ while len(dirname) > len(toplevel) and dirname not in hg_dirs:
+ hg_dirs.add(dirname)
+ dirname = os.path.dirname(dirname)
+ return hg_files, hg_dirs
+
+
+def hg_find_files(path=''):
+ toplevel = _hg_toplevel(path)
+ if not toplevel:
+ return []
+ hg_files, hg_dirs = _hg_ls_files_and_dirs(toplevel)
+ return scm_find_files(path, hg_files, hg_dirs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/setuptools_scm/git.py
new/setuptools_scm-2.1.0/setuptools_scm/git.py
--- old/setuptools_scm-2.0.0/setuptools_scm/git.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm/git.py 2018-05-13
10:55:37.000000000 +0200
@@ -2,8 +2,6 @@
from .version import meta
from os.path import isfile, join
-import subprocess
-import tarfile
import warnings
@@ -128,13 +126,3 @@
return meta(tag, distance=number, node=node, dirty=dirty,
branch=branch)
else:
return meta(tag, node=node, dirty=dirty, branch=branch)
-
-
-def list_files_in_archive(path):
- """List the files that 'git archive' generates.
- """
- cmd = ['git', 'archive', 'HEAD']
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=path)
- tf = tarfile.open(fileobj=proc.stdout, mode='r|*')
- return [member.name for member in tf.getmembers()
- if member.type != tarfile.DIRTYPE]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/setuptools_scm/hg.py
new/setuptools_scm-2.1.0/setuptools_scm/hg.py
--- old/setuptools_scm-2.0.0/setuptools_scm/hg.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm/hg.py 2018-05-13
10:55:37.000000000 +0200
@@ -2,8 +2,6 @@
from .utils import do, trace, data_from_mime, has_command
from .version import meta, tags_to_versions
-FILES_COMMAND = 'hg locate -I .'
-
def _hg_tagdist_normalize_tagcommit(root, tag, dist, node, branch):
dirty = node.endswith('+')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/setuptools_scm/integration.py
new/setuptools_scm-2.1.0/setuptools_scm/integration.py
--- old/setuptools_scm-2.0.0/setuptools_scm/integration.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm/integration.py 2018-05-13
10:55:37.000000000 +0200
@@ -1,4 +1,4 @@
-import os
+from pkg_resources import iter_entry_points
from .version import _warn_if_setuptools_outdated
from .utils import do
@@ -22,22 +22,14 @@
dist.metadata.version = get_version(**value)
-def find_files(path='.'):
- if not path:
- path = '.'
- abs = os.path.abspath(path)
- ep = next(iter_matching_entrypoints(
- abs, 'setuptools_scm.files_command'), None)
- if ep:
+def find_files(path=''):
+ for ep in iter_entry_points('setuptools_scm.files_command'):
command = ep.load()
- try:
- if isinstance(command, str):
- return do(ep.load(), path).splitlines()
- else:
- return command(path)
- except Exception:
- print("File Finder Failed for %s" % ep)
- raise
-
- else:
- return []
+ if isinstance(command, str):
+ # this technique is deprecated
+ res = do(ep.load(), path or '.').splitlines()
+ else:
+ res = command(path)
+ if res:
+ return res
+ return []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/setuptools_scm.egg-info/PKG-INFO
new/setuptools_scm-2.1.0/setuptools_scm.egg-info/PKG-INFO
--- old/setuptools_scm-2.0.0/setuptools_scm.egg-info/PKG-INFO 2018-04-10
10:28:15.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm.egg-info/PKG-INFO 2018-05-13
10:56:03.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: setuptools-scm
-Version: 2.0.0
+Version: 2.1.0
Summary: the blessed package to manage your versions by scm tags
Home-page: https://github.com/pypa/setuptools_scm/
Author: Ronny Pfannschmidt
@@ -88,6 +88,7 @@
.. code:: python
+ # contents of docs/conf.py
from pkg_resources import get_distribution
release = get_distribution('myproject').version
# for example take major/minor
@@ -292,12 +293,21 @@
.. code:: python
+ # content of setup.py
+ import setuptools
+
def myversion():
from setuptools_scm.version import get_local_dirty_tag
def clean_scheme(version):
return get_local_dirty_tag(version) if version.dirty else
'+clean'
return {'local_scheme': clean_scheme}
+
+ setup(
+ ...,
+ use_scm_version=myversion,
+ ...
+ )
Code of Conduct
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/setuptools_scm.egg-info/SOURCES.txt
new/setuptools_scm-2.1.0/setuptools_scm.egg-info/SOURCES.txt
--- old/setuptools_scm-2.0.0/setuptools_scm.egg-info/SOURCES.txt
2018-04-10 10:28:15.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm.egg-info/SOURCES.txt
2018-05-13 10:56:03.000000000 +0200
@@ -10,6 +10,9 @@
setuptools_scm/__init__.py
setuptools_scm/__main__.py
setuptools_scm/discover.py
+setuptools_scm/file_finder.py
+setuptools_scm/file_finder_git.py
+setuptools_scm/file_finder_hg.py
setuptools_scm/git.py
setuptools_scm/hacks.py
setuptools_scm/hg.py
@@ -26,6 +29,7 @@
testing/conftest.py
testing/runtests_travis.py
testing/test_basic_api.py
+testing/test_file_finder.py
testing/test_functions.py
testing/test_git.py
testing/test_main.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/setuptools_scm.egg-info/entry_points.txt
new/setuptools_scm-2.1.0/setuptools_scm.egg-info/entry_points.txt
--- old/setuptools_scm-2.0.0/setuptools_scm.egg-info/entry_points.txt
2018-04-10 10:28:15.000000000 +0200
+++ new/setuptools_scm-2.1.0/setuptools_scm.egg-info/entry_points.txt
2018-05-13 10:56:03.000000000 +0200
@@ -15,8 +15,8 @@
pip-egg-info = setuptools_scm.hacks:parse_pip_egg_info
[setuptools_scm.files_command]
- .hg = setuptools_scm.hg:FILES_COMMAND
- .git = setuptools_scm.git:list_files_in_archive
+ .hg = setuptools_scm.file_finder_hg:hg_find_files
+ .git = setuptools_scm.file_finder_git:git_find_files
[setuptools_scm.version_scheme]
guess-next-dev = setuptools_scm.version:guess_next_dev_version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/testing/conftest.py
new/setuptools_scm-2.1.0/testing/conftest.py
--- old/setuptools_scm-2.0.0/testing/conftest.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/testing/conftest.py 2018-05-13
10:55:37.000000000 +0200
@@ -42,6 +42,10 @@
else:
return given_reason
+ def add_and_commit(self, reason=None):
+ self(self.add_command)
+ self.commit(reason)
+
def commit(self, reason=None):
reason = self._reason(reason)
self(self.commit_command, reason=reason)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/testing/test_file_finder.py
new/setuptools_scm-2.1.0/testing/test_file_finder.py
--- old/setuptools_scm-2.0.0/testing/test_file_finder.py 1970-01-01
01:00:00.000000000 +0100
+++ new/setuptools_scm-2.1.0/testing/test_file_finder.py 2018-05-13
10:55:37.000000000 +0200
@@ -0,0 +1,214 @@
+import os
+import sys
+
+import pytest
+
+from setuptools_scm.integration import find_files
+
+
[email protected](params=['git', 'hg'])
+def inwd(request, wd):
+ if request.param == 'git':
+ wd('git init')
+ wd('git config user.email [email protected]')
+ wd('git config user.name "a test"')
+ wd.add_command = 'git add .'
+ wd.commit_command = 'git commit -m test-{reason}'
+ elif request.param == 'hg':
+ wd('hg init')
+ wd.add_command = 'hg add .'
+ wd.commit_command = 'hg commit -m test-{reason} -u test -d "0 0"'
+ (wd.cwd / 'file1').ensure(file=True)
+ adir = (wd.cwd / 'adir').ensure(dir=True)
+ (adir / 'filea').ensure(file=True)
+ bdir = (wd.cwd / 'bdir').ensure(dir=True)
+ (bdir / 'fileb').ensure(file=True)
+ wd.add_and_commit()
+ with wd.cwd.as_cwd():
+ yield wd
+
+
+def _sep(paths):
+ return {
+ path.replace('/', os.path.sep)
+ for path in paths
+ }
+
+
+def test_basic(inwd):
+ assert set(find_files()) == _sep({
+ 'file1',
+ 'adir/filea',
+ 'bdir/fileb',
+ })
+ assert set(find_files('.')) == _sep({
+ './file1',
+ './adir/filea',
+ './bdir/fileb',
+ })
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ })
+
+
+def test_whitespace(inwd):
+ (inwd.cwd / 'adir' / 'space file').ensure(file=True)
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/space file',
+ 'adir/filea',
+ })
+
+
+def test_case(inwd):
+ (inwd.cwd / 'CamelFile').ensure(file=True)
+ (inwd.cwd / 'file2').ensure(file=True)
+ inwd.add_and_commit()
+ assert set(find_files()) == _sep({
+ 'CamelFile',
+ 'file2',
+ 'file1',
+ 'adir/filea',
+ 'bdir/fileb',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to dir not supported")
+def test_symlink_dir(inwd):
+ (inwd.cwd / 'adir' / 'bdirlink').mksymlinkto('../bdir')
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ 'adir/bdirlink/fileb',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to dir not supported")
+def test_symlink_dir_source_not_in_scm(inwd):
+ (inwd.cwd / 'adir' / 'bdirlink').mksymlinkto('../bdir')
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to files not supported on windows")
+def test_symlink_file(inwd):
+ (inwd.cwd / 'adir' / 'file1link').mksymlinkto('../file1')
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ 'adir/file1link', # -> ../file1
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to files not supported on windows")
+def test_symlink_file_source_not_in_scm(inwd):
+ (inwd.cwd / 'adir' / 'file1link').mksymlinkto('../file1')
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to dir not supported")
+def test_symlink_loop(inwd):
+ (inwd.cwd / 'adir' / 'loop').mksymlinkto('../adir')
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ 'adir/loop', # -> ../adir
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to dir not supported")
+def test_symlink_loop_outside_path(inwd):
+ (inwd.cwd / 'bdir' / 'loop').mksymlinkto('../bdir')
+ (inwd.cwd / 'adir' / 'bdirlink').mksymlinkto('../bdir')
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ 'adir/bdirlink/fileb',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to dir not supported")
+def test_symlink_dir_out_of_git(inwd):
+ (inwd.cwd / 'adir' / 'outsidedirlink').\
+ mksymlinkto(os.path.join(__file__, '..'))
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks to files not supported on windows")
+def test_symlink_file_out_of_git(inwd):
+ (inwd.cwd / 'adir' / 'outsidefilelink').mksymlinkto(__file__)
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ })
+
+
+def test_empty_root(inwd):
+ subdir = inwd.cwd / 'cdir' / 'subdir'
+ subdir.ensure(dir=True)
+ (subdir / 'filec').ensure(file=True)
+ inwd.add_and_commit()
+ assert set(find_files('cdir')) == _sep({
+ 'cdir/subdir/filec',
+ })
+
+
+def test_empty_subdir(inwd):
+ subdir = inwd.cwd / 'adir' / 'emptysubdir' / 'subdir'
+ subdir.ensure(dir=True)
+ (subdir / 'xfile').ensure(file=True)
+ inwd.add_and_commit()
+ assert set(find_files('adir')) == _sep({
+ 'adir/filea',
+ 'adir/emptysubdir/subdir/xfile',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks not supported on windows")
+def test_double_include_through_symlink(inwd):
+ (inwd.cwd / 'data').ensure(dir=True)
+ (inwd.cwd / 'data' / 'datafile').ensure(file=True)
+ (inwd.cwd / 'adir' / 'datalink').mksymlinkto('../data')
+ (inwd.cwd / 'adir' / 'filealink').mksymlinkto('filea')
+ inwd.add_and_commit()
+ assert set(find_files()) == _sep({
+ 'file1',
+ 'adir/datalink', # -> ../data
+ 'adir/filealink', # -> filea
+ 'adir/filea',
+ 'bdir/fileb',
+ 'data/datafile',
+ })
+
+
[email protected](sys.platform == 'win32',
+ reason="symlinks not supported on windows")
+def test_symlink_not_in_scm_while_target_is(inwd):
+ (inwd.cwd / 'data').ensure(dir=True)
+ (inwd.cwd / 'data' / 'datafile').ensure(file=True)
+ inwd.add_and_commit()
+ (inwd.cwd / 'adir' / 'datalink').mksymlinkto('../data')
+ (inwd.cwd / 'adir' / 'filealink').mksymlinkto('filea')
+ assert set(find_files()) == _sep({
+ 'file1',
+ 'adir/filea',
+ # adir/datalink and adir/afilelink not included
+ # because the symlink themselves are not in scm
+ 'bdir/fileb',
+ 'data/datafile',
+ })
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/testing/test_git.py
new/setuptools_scm-2.1.0/testing/test_git.py
--- old/setuptools_scm-2.0.0/testing/test_git.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/testing/test_git.py 2018-05-13
10:55:37.000000000 +0200
@@ -3,6 +3,7 @@
from setuptools_scm import git
import pytest
from datetime import date
+from os.path import join as opj
@pytest.fixture
@@ -123,7 +124,8 @@
'/test1.txt -export-ignore\n/test2.txt export-ignore')
wd('git add test1.txt test2.txt')
wd.commit()
- assert integration.find_files(str(wd.cwd)) == ['test1.txt']
+ with wd.cwd.as_cwd():
+ assert integration.find_files('.') == [opj('.', 'test1.txt')]
@pytest.mark.issue(228)
@@ -132,7 +134,18 @@
wd.write('foobar/test1.txt', 'test')
wd('git add foobar')
wd.commit()
- assert integration.find_files(str(wd.cwd)) == ['foobar/test1.txt']
+ with wd.cwd.as_cwd():
+ assert integration.find_files('.') == [opj('.', 'foobar', 'test1.txt')]
+
+
[email protected](251)
+def test_git_archive_run_from_subdirectory(wd):
+ wd('mkdir foobar')
+ wd.write('foobar/test1.txt', 'test')
+ wd('git add foobar')
+ wd.commit()
+ with (wd.cwd / 'foobar').as_cwd():
+ assert integration.find_files('.') == [opj('.', 'test1.txt')]
def test_git_feature_branch_increments_major(wd):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/testing/test_mercurial.py
new/setuptools_scm-2.1.0/testing/test_mercurial.py
--- old/setuptools_scm-2.0.0/testing/test_mercurial.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/testing/test_mercurial.py 2018-05-13
10:55:37.000000000 +0200
@@ -41,7 +41,12 @@
def test_find_files_stop_at_root_hg(wd):
wd.commit_testfile()
wd.cwd.ensure('project/setup.cfg')
+ # setup.cfg has not been committed
assert integration.find_files(str(wd.cwd / 'project')) == []
+ # issue 251
+ wd.add_and_commit()
+ with (wd.cwd / 'project').as_cwd():
+ assert integration.find_files() == ['setup.cfg']
# XXX: better tests for tag prefixes
@@ -160,7 +165,7 @@
""" Tests that tags not containing a "." are ignored, the same as for git.
Note that will be superceded by the fix for pypa/setuptools_scm/issues/235
"""
- wd('hg tag some-random-tag')
+ wd('hg tag some-random-tag -u test -d "0 0"')
assert wd.version == '1.0.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools_scm-2.0.0/testing/test_regressions.py
new/setuptools_scm-2.1.0/testing/test_regressions.py
--- old/setuptools_scm-2.0.0/testing/test_regressions.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/testing/test_regressions.py 2018-05-13
10:55:37.000000000 +0200
@@ -53,8 +53,8 @@
def test_pip_download(tmpdir, monkeypatch):
monkeypatch.chdir(tmpdir)
subprocess.check_call([
- sys.executable, '-c',
- 'import pip;pip.main()', 'download', 'lz4==0.9.0',
+ sys.executable, '-m',
+ 'pip', 'download', 'lz4==0.9.0',
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools_scm-2.0.0/testing/test_setuptools_support.py
new/setuptools_scm-2.1.0/testing/test_setuptools_support.py
--- old/setuptools_scm-2.0.0/testing/test_setuptools_support.py 2018-04-10
10:27:36.000000000 +0200
+++ new/setuptools_scm-2.1.0/testing/test_setuptools_support.py 2018-05-13
10:55:37.000000000 +0200
@@ -5,9 +5,14 @@
import os
import subprocess
import pytest
-pytestmark = pytest.mark.skipif(
- "sys.version_info >= (3,6,0)",
- reason="integration with old versions no longer needed on py3.6+")
+pytestmark = [
+ pytest.mark.skipif(
+ "sys.version_info >= (3,6,0)",
+ reason="integration with old versions no longer needed on py3.6+"),
+ pytest.mark.xfail(
+ sys.platform == 'win32',
+ reason="path behaves unexpected on windows ci"),
+]
@pytest.fixture(scope='session')
@@ -26,24 +31,26 @@
SCRIPT = """
+from __future__ import print_function
+import sys
import setuptools
-print(setuptools.__version__)
+print(setuptools.__version__, 'expected', sys.argv[1])
import setuptools_scm.version
from setuptools_scm.__main__ import main
main()
"""
-def check(packagedir, **env):
+def check(packagedir, expected_version, **env):
subprocess.check_call(
- [sys.executable, '-c', SCRIPT],
+ [sys.executable, '-c', SCRIPT, expected_version],
env=dict(os.environ, PYTHONPATH=".:" + str(packagedir), **env))
def test_old_setuptools_fails(get_setuptools_packagedir):
packagedir = get_setuptools_packagedir("0.9.8")
with pytest.raises(subprocess.CalledProcessError):
- check(packagedir)
+ check(packagedir, "0.9.8")
def test_old_setuptools_allows_with_warnings(get_setuptools_packagedir):
@@ -51,10 +58,10 @@
packagedir = get_setuptools_packagedir("0.9.8")
# filter using warning since in the early python startup
check(
- packagedir,
+ packagedir, "0.9.8",
PYTHONWARNINGS="once::Warning")
def test_distlib_setuptools_works(get_setuptools_packagedir):
packagedir = get_setuptools_packagedir("12.0.1")
- check(packagedir)
+ check(packagedir, "12.0.1")