summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-01-14 21:24:07 -0500
committerJason R. Coombs <jaraco@jaraco.com>2022-01-14 21:32:39 -0500
commit110af0bfb342edc145c2bde58abe876b1eead985 (patch)
tree2742c5bf34c9e96a52cc3c7ac682b6a90b9fc015 /tools
parentbefd59a42b7cc6f0ea043a437b50a06234dffdbc (diff)
downloadpython-setuptools-git-110af0bfb342edc145c2bde58abe876b1eead985.tar.gz
Simplify vendored script to simply include the metadata.
Diffstat (limited to 'tools')
-rw-r--r--tools/vendored.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/tools/vendored.py b/tools/vendored.py
index b4565d96..ee34dc0f 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -1,7 +1,6 @@
import re
import sys
import subprocess
-from fnmatch import fnmatch
from path import Path
@@ -52,42 +51,9 @@ def install(vendor):
'-t', str(vendor),
]
subprocess.check_call(install_args)
- move_licenses(vendor)
- remove_all(vendor.glob('*.dist-info'))
- remove_all(vendor.glob('*.egg-info'))
(vendor / '__init__.py').write_text('')
-def move_licenses(vendor):
- license_patterns = ("*LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*")
- licenses = (
- entry
- for path in vendor.glob("*.dist-info")
- for entry in path.glob("*")
- if any(fnmatch(str(entry), p) for p in license_patterns)
- )
- for file in licenses:
- file.move(_find_license_dest(file, vendor))
-
-
-def _find_license_dest(license_file, vendor):
- basename = license_file.basename()
- pkg = license_file.dirname().basename().replace(".dist-info", "")
- parts = pkg.split("-")
- acc = []
- for part in parts:
- # Find actual name from normalized name + version
- acc.append(part)
- for option in ("_".join(acc), "-".join(acc), ".".join(acc)):
- candidate = vendor / option
- if candidate.isdir():
- return candidate / basename
- if Path(f"{candidate}.py").isfile():
- return Path(f"{candidate}.{basename}")
-
- raise FileNotFoundError(f"No destination found for {license_file}")
-
-
def update_pkg_resources():
vendor = Path('pkg_resources/_vendor')
install(vendor)