Python 2.7 fixes.

This commit is contained in:
Dave Page 2019-02-08 15:06:38 +00:00
parent a4cd2fe6c6
commit 9c3da10eea

View File

@ -23,12 +23,12 @@ from subprocess import Popen, PIPE
# Column sizes # Column sizes
name_size = 64 name_size = 64
version_size = 16 version_size = 16
licence_size = 32 licence_size = 36
def print_title(title): def print_title(title):
print(title) print(title)
print("=" * len(title), "\n") print(("=" * len(title)) + "\n")
def print_row(name, version, licence, url): def print_row(name, version, licence, url):
@ -48,7 +48,7 @@ def print_summary(count):
def get_python_deps(): def get_python_deps():
# Get the path to the requirements.txt file # Get the path to the requirements.txt file
req_file = os.path.realpath(os.path.dirname(__file__) + req_file = os.path.realpath(os.path.dirname(os.path.abspath(__file__)) +
"/../requirements.txt") "/../requirements.txt")
with open(req_file, 'r') as req_file_p: with open(req_file, 'r') as req_file_p:
@ -65,7 +65,6 @@ def get_python_deps():
# Iterate the packages and get the distribution info for each # Iterate the packages and get the distribution info for each
for pkg in requirements: for pkg in requirements:
metadata = []
try: try:
distribution = pkg_resources.get_distribution(pkg) distribution = pkg_resources.get_distribution(pkg)
@ -95,7 +94,7 @@ def get_python_deps():
try: try:
metadata = distribution.get_metadata_lines('METADATA') metadata = distribution.get_metadata_lines('METADATA')
except FileNotFoundError: except IOError:
metadata = distribution.get_metadata_lines('PKG-INFO') metadata = distribution.get_metadata_lines('PKG-INFO')
# Somewhere to store the info we need... # Somewhere to store the info we need...
@ -138,7 +137,8 @@ def get_python_deps():
def get_js_deps(): def get_js_deps():
# Get the path to package.json file # Get the path to package.json file
web_dir = os.path.realpath(os.path.dirname(__file__) + "/../web/") web_dir = os.path.realpath(os.path.dirname(os.path.abspath(__file__)) +
"/../web/")
# Build the Yarn command # Build the Yarn command
cmd = ["yarn", "--cwd", web_dir, "licenses", "list", "--json"] cmd = ["yarn", "--cwd", web_dir, "licenses", "list", "--json"]
@ -181,7 +181,7 @@ def dump_header():
"dependent on various third party libraries. These are " "dependent on various third party libraries. These are "
"automatically compiled from the system, requirements.txt." "automatically compiled from the system, requirements.txt."
"and packages.json and list below.", "and packages.json and list below.",
width=79), "\n") width=79) + "\n")
def dump_cplusplus(): def dump_cplusplus():