From 5abf5f5f2cf93c57ac74220251d2a2acce5f7099 Mon Sep 17 00:00:00 2001 From: dankm Date: Fri, 28 Apr 2023 15:10:34 -0600 Subject: setup.py: use pkg-config for udev/rules path (#2137) Distributions other than RHEL also use /usr/lib/udev for the rules path. Instead of hardcoding the udev rules path for RedHat, check pkg-config for the proper location. --- setup.py | 14 ++++++++------ tools/.github-cla-signers | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 8919c384..d0b1c996 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,10 @@ def pkg_config_read(library, var): "systemdsystemconfdir": "/etc/systemd/system", "systemdsystemunitdir": "/lib/systemd/system", "systemdsystemgeneratordir": "/lib/systemd/system-generators", - } + }, + "udev": { + "udevdir": "/lib/udev", + }, } cmd = ["pkg-config", "--variable=%s" % var, library] try: @@ -307,14 +310,13 @@ data_files = [ ), ] if not platform.system().endswith("BSD"): - - RULES_PATH = LIB - if os.path.isfile("/etc/redhat-release"): - RULES_PATH = "/usr/lib" + RULES_PATH = pkg_config_read("udev", "udevdir") + if not in_virtualenv(): + RULES_PATH = "/" + RULES_PATH data_files.extend( [ - (RULES_PATH + "/udev/rules.d", [f for f in glob("udev/*.rules")]), + (RULES_PATH + "/rules.d", [f for f in glob("udev/*.rules")]), ( ETC + "/systemd/system/sshd-keygen@.service.d/", ["systemd/disable-sshd-keygen-if-cloud-init-active.conf"], diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index 5d3cf7ac..7615f0fb 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -33,6 +33,7 @@ cjp256 Conan-Kudo cvstealth dankenigsberg +dankm david-caro dbungert ddymko -- cgit v1.2.1