Skip to content

Commit 2eb1281

Browse files
Merge pull request #233 from sileht/easyinstall-issue
git: Use a method instead of a command for listing files
2 parents 21792b1 + b8a6232 commit 2eb1281

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def parse(root):
8282
8383
[setuptools_scm.files_command]
8484
.hg = setuptools_scm.hg:FILES_COMMAND
85-
.git = setuptools_scm.git:FILES_COMMAND
85+
.git = setuptools_scm.git:list_files_in_archive
8686
8787
[setuptools_scm.version_scheme]
8888
guess-next-dev = setuptools_scm.version:guess_next_dev_version

setuptools_scm/git.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from os.path import isfile, join
55
import subprocess
6-
import sys
76
import tarfile
87
import warnings
98

@@ -14,7 +13,6 @@
1413
from .win_py31_compat import samefile
1514

1615

17-
FILES_COMMAND = sys.executable + ' -m setuptools_scm.git'
1816
DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*'
1917

2018

@@ -123,16 +121,11 @@ def parse(root, describe_command=DEFAULT_DESCRIBE, pre_parse=warn_on_shallow):
123121
return meta(tag, node=node, dirty=dirty)
124122

125123

126-
def _list_files_in_archive():
124+
def list_files_in_archive(path):
127125
"""List the files that 'git archive' generates.
128126
"""
129127
cmd = ['git', 'archive', 'HEAD']
130-
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
128+
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=path)
131129
tf = tarfile.open(fileobj=proc.stdout, mode='r|*')
132-
for member in tf.getmembers():
133-
if member.type != tarfile.DIRTYPE:
134-
print(member.name)
135-
136-
137-
if __name__ == "__main__":
138-
_list_files_in_archive()
130+
return [member.name for member in tf.getmembers()
131+
if member.type != tarfile.DIRTYPE]

0 commit comments

Comments
 (0)