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(
295
295
return meta (versions [0 ], config = config )
296
296
else :
297
297
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 :
301
299
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 )
302
305
303
306
304
307
def parse_archival (
Original file line number Diff line number Diff line change 24
24
from setuptools_scm import NonNormalizedVersion
25
25
from setuptools_scm .file_finder_git import git_find_files
26
26
from setuptools_scm .git import archival_to_version
27
+ from setuptools_scm .utils import data_from_mime
27
28
from setuptools_scm .utils import do
28
29
from setuptools_scm .utils import has_command
29
30
@@ -543,3 +544,14 @@ def test_git_archival_node_missing_no_version() -> None:
543
544
config = Configuration ()
544
545
version = archival_to_version ({}, config = config )
545
546
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