Skip to content

Commit

Permalink
Fix Python install warnings (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Oct 11, 2023
1 parent 4a163bc commit d7a9f76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion python/config/Make.rules
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ python_cppflags := $(filter-out -Wunreachable-code -Wstrict-prototypes,$
#
# Python installation directory
#
install_pythondir = $(or $(PYTHON_INSTALLDIR),$(if $(usr_dir_install),$(shell $(PYTHON) $(lang_srcdir)/config/install_dir),$(prefix)/python))
install_pythondir = $(or $(PYTHON_INSTALLDIR),$(shell $(PYTHON) $(lang_srcdir)/config/install_dir $(prefix)))

#
# Rules to build a python module. We just compute the name of the python module
Expand Down
43 changes: 19 additions & 24 deletions python/config/install_dir
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@
# Copyright (c) ZeroC, Inc. All rights reserved.
#

from setuptools.command.easy_install import easy_install
class easy_install_default(easy_install):
""" class easy_install had problems with the fist parameter not being
an instance of Distribution, even though it was. This is due to
some import-related mess.
"""
import os
import site
import sys

def __init__(self):
from distutils.dist import Distribution
dist = Distribution()
self.distribution = dist
self.initialize_options()
self._dry_run = None
self.verbose = dist.verbose
self.force = None
self.help = 0
self.finalized = 0
if len(sys.argv) != 2:
print("Usage: {} [prefix]".format(sys.argv[0]))
sys.exit(1)

e = easy_install_default()
import os, distutils.errors
try:
e.finalize_options()
except distutils.errors.DistutilsError:
pass
prefix = sys.argv[1]
libdir = os.path.join(prefix, "lib")

# Place the source files and the extension in a subdirectory of the installation directory.
print(e.install_dir)
for dir in site.getsitepackages():
if dir.startswith(libdir):
print(dir)
sys.exit(0)

for dir in site.getsitepackages():
if dir.startswith(prefix):
print(dir)
sys.exit(0)

print(os.path.join(prefix, "python"))

0 comments on commit d7a9f76

Please sign in to comment.