File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,12 @@ def find_extra_reqs(options, requirements_filename):
34
34
here = pathlib .Path ('.' ).resolve ()
35
35
item_location_rel = (pathlib .Path (package_location ) / item )
36
36
item_location = item_location_rel .resolve ()
37
- if item_location . is_relative_to ( here ) :
37
+ try :
38
38
relative_item_location = item_location .relative_to (here )
39
- else :
39
+ except ValueError :
40
+ # Ideally we would use Pathlib.is_relative_to rather than
41
+ # checking for a ValueError, but that is only available in
42
+ # Python 3.9+.
40
43
relative_item_location = item_location
41
44
package_files .append (str (relative_item_location ))
42
45
Original file line number Diff line number Diff line change @@ -41,9 +41,12 @@ def find_missing_reqs(options, requirements_filename):
41
41
here = pathlib .Path ('.' ).resolve ()
42
42
item_location_rel = (pathlib .Path (package_location ) / item )
43
43
item_location = item_location_rel .resolve ()
44
- if item_location . is_relative_to ( here ) :
44
+ try :
45
45
relative_item_location = item_location .relative_to (here )
46
- else :
46
+ except ValueError :
47
+ # Ideally we would use Pathlib.is_relative_to rather than
48
+ # checking for a ValueError, but that is only available in
49
+ # Python 3.9+.
47
50
relative_item_location = item_location
48
51
package_files .append (str (relative_item_location ))
49
52
You can’t perform that action at this time.
0 commit comments