Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python install warnings #1545

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
44 changes: 20 additions & 24 deletions python/config/install_dir
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,26 @@
# 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"))
2 changes: 1 addition & 1 deletion scripts/IceStormUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def getExe(self, current):

def setup(self, current):
# Create the database directory
self.dbdir = os.path.join(current.testsuite.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica))
if self.createDb:
self.dbdir = os.path.join(current.testsuite.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica))
if os.path.exists(self.dbdir):
shutil.rmtree(self.dbdir)
os.mkdir(self.dbdir)
Expand Down