Browse Source

* adding warning when both dpkg and rpmbuild are present
* check for /usr/bin/dpkg-architecture instead of /usr/bin/dpkg-deb (latter appears to be present on Fedora)
* insert python site package path into INSTALLSPEC from current interpreter instead of %{__python} (fixes Python 3)

Jonas Thiem 11 years ago
parent
commit
c11c46a6b1
1 changed files with 18 additions and 4 deletions
  1. 18 4
      makepanda/makepanda.py

+ 18 - 4
makepanda/makepanda.py

@@ -6184,11 +6184,15 @@ Description: Runtime binary and browser plugin for the Panda3D Game Engine
 
 
 """
 """
 
 
+def python_sitepackages_path():
+    from distutils.sysconfig import get_python_lib
+    return get_python_lib(1)
+PYTHON_SITEPACKAGES=python_sitepackages_path()
+
 # We're not putting "python" in the "Requires" field,
 # We're not putting "python" in the "Requires" field,
 # since the rpm-based distros don't have a common
 # since the rpm-based distros don't have a common
 # naming for the Python package.
 # naming for the Python package.
 INSTALLER_SPEC_FILE="""
 INSTALLER_SPEC_FILE="""
-%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
 Summary: The Panda3D free 3D engine SDK
 Summary: The Panda3D free 3D engine SDK
 Name: panda3d
 Name: panda3d
 Version: VERSION
 Version: VERSION
@@ -6217,7 +6221,7 @@ This package contains the SDK for development with Panda3D, install panda3d-runt
 /usr/share/applications/*.desktop
 /usr/share/applications/*.desktop
 /etc/ld.so.conf.d/panda3d.conf
 /etc/ld.so.conf.d/panda3d.conf
 /usr/%_lib/panda3d
 /usr/%_lib/panda3d
-%{python_sitearch}
+""" + PYTHON_SITEPACKAGES + """
 /usr/include/panda3d
 /usr/include/panda3d
 """
 """
 
 
@@ -6285,7 +6289,17 @@ def MakeInstallerLinux():
     oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec")
     oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec")
     oscmd("mkdir --mode=0755 targetroot")
     oscmd("mkdir --mode=0755 targetroot")
 
 
-    if os.path.exists("/usr/bin/dpkg-deb"):
+    dpkg_present = False
+    if os.path.exists("/usr/bin/dpkg-architecture"):
+        dpkg_present = True
+    rpmbuild_present = False
+    if os.path.exists("/usr/bin/rpmbuild"):
+        rpmbuild_present = True
+
+    if dpkg_present and rpmbuild_present:
+        print("Warning: both dpkg-architecture and rpmbuild present.")
+
+    if dpkg_present:
         # Invoke installpanda.py to install it into a temporary dir
         # Invoke installpanda.py to install it into a temporary dir
         lib_dir = GetDebLibDir()
         lib_dir = GetDebLibDir()
         if RUNTIME:
         if RUNTIME:
@@ -6372,7 +6386,7 @@ def MakeInstallerLinux():
             oscmd("chmod 644 targetroot/DEBIAN/conffiles targetroot/DEBIAN/symbols")
             oscmd("chmod 644 targetroot/DEBIAN/conffiles targetroot/DEBIAN/symbols")
         oscmd("fakeroot dpkg-deb -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch))
         oscmd("fakeroot dpkg-deb -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch))
 
 
-    elif os.path.exists("/usr/bin/rpmbuild"):
+    elif rpmbuild_present:
         # Invoke installpanda.py to install it into a temporary dir
         # Invoke installpanda.py to install it into a temporary dir
         if RUNTIME:
         if RUNTIME:
             InstallRuntime(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=GetRPMLibDir())
             InstallRuntime(destdir="targetroot", prefix="/usr", outputdir=GetOutputDir(), libdir=GetRPMLibDir())