File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -295,10 +295,13 @@ def archival_to_version(
295295 return meta (versions [0 ], config = config )
296296 else :
297297 node = data .get ("node" )
298- if node is not None :
299- return meta ("0.0" , node = node , config = config )
300- else :
298+ if node is None :
301299 return None
300+ elif "$FORMAT" in node .upper ():
301+ warnings .warn ("unexported git archival found" )
302+ return None
303+ else :
304+ return meta ("0.0" , node = node , config = config )
302305
303306
304307def parse_archival (
Original file line number Diff line number Diff line change 2424from setuptools_scm import NonNormalizedVersion
2525from setuptools_scm .file_finder_git import git_find_files
2626from setuptools_scm .git import archival_to_version
27+ from setuptools_scm .utils import data_from_mime
2728from setuptools_scm .utils import do
2829from setuptools_scm .utils import has_command
2930
@@ -543,3 +544,14 @@ def test_git_archival_node_missing_no_version() -> None:
543544 config = Configuration ()
544545 version = archival_to_version ({}, config = config )
545546 assert version is None
547+
548+
549+ def test_git_archhival_from_unfiltered () -> None :
550+ config = Configuration ()
551+
552+ import setuptools_scm
553+
554+ data = data_from_mime (Path (setuptools_scm .__file__ ).parent / ".git_archival.txt" )
555+ with pytest .warns (UserWarning , match = "unexported git archival found" ):
556+ version = archival_to_version (data , config = config )
557+ assert version is None
You can’t perform that action at this time.
0 commit comments