I tried to use python-vendorize on a package that includes a bin/app_cli.py data file. Ideally, this file would be formatted as an entry point instead, but the way it is packaged now shows up as ../../bin/app_cli.py in RECORD. This puts a .. in the top_level_names set which throws off the way relative imports end up getting written. I think filtering out paths that start with ../ in the following section would be sufficient?
|
def _read_top_level_names_from_dist_info(dist_info_path): |
|
path = os.path.join(dist_info_path, "RECORD") |
|
|
|
if not os.path.exists(path): |
|
return |
|
|
|
py_extension = ".py" |
|
|
|
with open(path, "rt", encoding="utf-8") as fileobj: |
|
for line in csv.reader(fileobj): |
|
if len(line) > 0: |
|
record_path = line[0] |
|
if record_path.endswith(py_extension): |
|
top_part = pathlib.Path(record_path).parts[0] |
|
if top_part.endswith(py_extension): |
|
yield top_part[:-len(py_extension)] |
|
else: |
|
yield top_part |
I tried to use
python-vendorizeon a package that includes abin/app_cli.pydata file. Ideally, this file would be formatted as an entry point instead, but the way it is packaged now shows up as../../bin/app_cli.pyinRECORD. This puts a..in thetop_level_namesset which throws off the way relative imports end up getting written. I think filtering out paths that start with../in the following section would be sufficient?python-vendorize/vendorize/__init__.py
Lines 54 to 71 in f42dcdc