Unverified Commit c0a1232f authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

Merge pull request #311372 from vinnymeller/update-uxsim

python3Packages.uxsim: 1.1.1 -> 1.3.0
parents 928411c8 1553285a
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
diff --git a/uxsim/__init__.py b/uxsim/__init__.py
index 01e1ad1..de1f0fd 100644
index cf661c5..540e6f8 100644
--- a/uxsim/__init__.py
+++ b/uxsim/__init__.py
@@ -1,8 +1,14 @@
-from .uxsim import *
-from .utils import *
@@ -1,3 +1,6 @@
+import os
+
 from .analyzer import *
+from .utils import *
+from .uxsim import *
+
+# Only set our own plugin path if it's not already set
+if not os.getenv("QT_PLUGIN_PATH"):
+    os.environ["QT_PLUGIN_PATH"] = "$NIX_QT_PLUGIN_PATH"
 
 __version__ = "1.1.1"
 __author__ = "Toru Seo"
 __copyright__ = "Copyright (c) 2023 Toru Seo"
-__license__ = "MIT License"
\ No newline at end of file
+__license__ = "MIT License"
 from .uxsim import *
 from .utils import *
 from .analyzer import *
+10 −15
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@
  setuptools,
  wheel,
  qt5,
  hackgen-font,
  python3,
  python,
  dill,
  matplotlib,
  numpy,
  pandas,
@@ -17,19 +17,17 @@
}:
buildPythonPackage rec {
  pname = "uxsim";
  version = "1.1.1";
  version = "1.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "toruseo";
    repo = "UXsim";
    rev = "v${version}";
    hash = "sha256-qPAFodvx+Z7RsRhzdTq1TRsbvrUFaqRJZxYg3FM6q8A=";
    rev = "refs/tags/v${version}";
    hash = "sha256-2lN2Cu0XXiYdLiE7phpGqhkBDjkmxLJt4ILb6ORWdCI=";
  };

  patches = [
    ./add-qt-plugin-path-to-env.patch
  ];
  patches = [ ./add-qt-plugin-path-to-env.patch ];

  nativeBuildInputs = [
    setuptools
@@ -37,6 +35,7 @@ buildPythonPackage rec {
  ];

  propagatedBuildInputs = [
    dill
    matplotlib
    numpy
    pandas
@@ -48,16 +47,12 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "uxsim" ];


  # QT_PLUGIN_PATH is required to be set for the program to produce its images
  # our patch sets it to $NIX_QT_PLUGIN_PATH if QT_PLUGIN_PATH is not set
  # and here we replace this string with the actual path to qt plugins
  postInstall = ''
    substituteInPlace $out/${python3.sitePackages}/uxsim/__init__.py \
    substituteInPlace $out/${python.sitePackages}/uxsim/__init__.py \
      --replace-fail '$NIX_QT_PLUGIN_PATH' '${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}'

    mkdir -p $out/${python3.sitePackages}/uxsim/files
    ln -s ${hackgen-font}/share/fonts/hackgen/HackGen-Regular.ttf $out/${python3.sitePackages}/uxsim/files/
  '';

  meta = with lib; {