From b4543a531af23166bcb04b10c25c4b3d46d01389 Mon Sep 17 00:00:00 2001 From: dtougas Date: Mon, 25 Mar 2019 17:59:02 -0400 Subject: [PATCH] Fixes as per PR #85 in main project --- libpip2pi/commands.py | 11 +++++------ .../expected-aggressively-normalized.txt | 2 +- tests/test_requirements_txt/expected-normal.txt | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libpip2pi/commands.py b/libpip2pi/commands.py index 28c0769..a928935 100644 --- a/libpip2pi/commands.py +++ b/libpip2pi/commands.py @@ -1,7 +1,7 @@ import os import re import sys -import cgi +import html import shutil import atexit import tempfile @@ -363,8 +363,7 @@ def _dir2pi(option, argv): try_symlink(option, pkg_dir_name, pkgdirpath("simple", normalize_pip67(pkg_name))) try_symlink(option, pkg_dir_name, pkgdirpath("simple", pkg_name)) - pkg_new_basename = "-".join([pkg_name, pkg_rest]) - symlink_target = os.path.join(pkg_dir, pkg_new_basename) + symlink_target = os.path.join(pkg_dir, pkg_basename) symlink_source = os.path.join("../../", pkg_basename) if option.use_symlink: try_symlink(option, symlink_source, symlink_target) @@ -375,15 +374,15 @@ def _dir2pi(option, argv): if pkg_name not in processed_pkg: pkg_index += "%s
\n" %( - cgi.escape(pkg_dir_name), - cgi.escape(pkg_name), + html.escape(pkg_dir_name), + html.escape(pkg_name), ) processed_pkg.add(pkg_name) if option.build_html: with open(os.path.join(pkg_dir, "index.html"), "a") as fp: fp.write("%(name)s
\n" %{ - "name": cgi.escape(pkg_new_basename), + "name": html.escape(pkg_basename), }) pkg_index += "\n" diff --git a/tests/test_requirements_txt/expected-aggressively-normalized.txt b/tests/test_requirements_txt/expected-aggressively-normalized.txt index 58f157f..a906015 100644 --- a/tests/test_requirements_txt/expected-aggressively-normalized.txt +++ b/tests/test_requirements_txt/expected-aggressively-normalized.txt @@ -8,5 +8,5 @@ simple/fish/index.html simple/index.html simple/normalization-test-with-dashes simple/normalization-test-with-dashes/index.html -simple/normalization-test-with-dashes/Normalization-Test.with-dashes-1.2rc3.zip -> ../../Normalization_Test.with-dashes-1.2rc3.zip +simple/normalization-test-with-dashes/Normalization_Test.with-dashes-1.2rc3.zip -> ../../Normalization_Test.with-dashes-1.2rc3.zip simple/normalization-test.with-dashes -> normalization-test-with-dashes diff --git a/tests/test_requirements_txt/expected-normal.txt b/tests/test_requirements_txt/expected-normal.txt index 206fa12..9f26d97 100644 --- a/tests/test_requirements_txt/expected-normal.txt +++ b/tests/test_requirements_txt/expected-normal.txt @@ -7,4 +7,4 @@ simple/fish/index.html simple/index.html simple/normalization-test-with-dashes simple/normalization-test-with-dashes/index.html -simple/normalization-test-with-dashes/Normalization-Test.with-dashes-1.2rc3.zip -> ../../Normalization_Test.with-dashes-1.2rc3.zip +simple/normalization-test-with-dashes/Normalization_Test.with-dashes-1.2rc3.zip -> ../../Normalization_Test.with-dashes-1.2rc3.zip