From 6322c4ab9d12b5711eead41821fe19149e515afc Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Fri, 16 Dec 2022 18:45:34 +0100
Subject: [PATCH] debian: replace python packaging hacks

It seems Debian setuputils can just use --install-layout=deb to move the
files to the correct location. This allows us to remove the manual
moving around of directories that was present until now.
---
 Makefile        | 2 --
 daemon/Makefile | 2 +-
 pylib/Makefile  | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -167,8 +167,6 @@
 ubuntu_install: setup_dkms ubuntu_udev_install ubuntu_daemon_install ubuntu_python_library_install appstream_install
 	@echo -e "\n::\033[34m Installing for Ubuntu\033[0m"
 	@echo "====================================================="
-	mv $(DESTDIR)$(PREFIX)/lib/python3.* $(DESTDIR)$(PREFIX)/lib/python3
-	mv $(DESTDIR)$(PREFIX)/lib/python3/site-packages $(DESTDIR)$(PREFIX)/lib/python3/dist-packages
 
 install_i_know_what_i_am_doing: all driver_install udev_install python_library_install
 	@make --no-print-directory -C daemon install DESTDIR=$(DESTDIR)
--- a/daemon/Makefile
+++ b/daemon/Makefile
@@ -22,7 +22,7 @@
 	python3 setup.py install --prefix=$(PREFIX) --root=$(DESTDIR)
 
 ubuntu_install: purge_pycache manpages install-resources
-	python3 setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --no-compile
+	python3 setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --no-compile --install-layout=deb
 
 manpages:
 	@install -m 644 -D -v resources/man/razer.conf.5 $(DESTDIR)$(PREFIX)/share/man/man5/razer.conf.5
--- a/pylib/Makefile
+++ b/pylib/Makefile
@@ -9,7 +9,7 @@
 	python3 setup.py install --prefix=/usr --root=$(DESTDIR)
 
 ubuntu_install: purge_pycache
-	python3 setup.py install --prefix=/usr --root=$(DESTDIR) --no-compile
+	python3 setup.py install --prefix=/usr --root=$(DESTDIR) --no-compile --install-layout=deb
 
 uninstall:
 	$(eval DAEMONPATH := $(shell find $(DESTDIR)/usr/lib/python3* -maxdepth 2 -name "razer"))
