summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-01-18 05:35:19 +0100
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-01-18 05:35:19 +0100
commit7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e (patch)
tree8f98901fa290a3eb9d03fdf4834f81130ef11a7e /pkgs/tools
parentc6a66632f9675ba361490823fee608b9578a0f52 (diff)
downloadnixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar.gz
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar.bz2
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar.lz
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar.xz
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.tar.zst
nixpkgs-7b19e25b87c3e6a4cdbc36607c9c99edac62fd0e.zip
qmake2cmake: init at 1.0.2
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/qmake2cmake/default.nix40
-rw-r--r--pkgs/tools/misc/qmake2cmake/fix-locations.patch36
2 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/tools/misc/qmake2cmake/default.nix b/pkgs/tools/misc/qmake2cmake/default.nix
new file mode 100644
index 00000000000..f9ff0dc6a7a
--- /dev/null
+++ b/pkgs/tools/misc/qmake2cmake/default.nix
@@ -0,0 +1,40 @@
+{ lib
+, buildPythonPackage
+, fetchgit
+, packaging
+, portalocker
+, sympy
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "qmake2cmake";
+  version = "1.0.2";
+
+  src = fetchgit {
+    url = "https://codereview.qt-project.org/qt/qmake2cmake";
+    rev = "v${version}";
+    hash = "sha256-Ibi7tIaMI44POfoRfKsgTMR3u+Li5UzeHBUNylnc9dw=";
+  };
+
+  patches = [
+    ./fix-locations.patch
+  ];
+
+  propagatedBuildInputs = [
+    packaging
+    portalocker
+    sympy
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  meta = with lib; {
+    description = "Tool to convert qmake .pro files to CMakeLists.txt";
+    homepage = "https://wiki.qt.io/Qmake2cmake";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ wegank ];
+  };
+}
diff --git a/pkgs/tools/misc/qmake2cmake/fix-locations.patch b/pkgs/tools/misc/qmake2cmake/fix-locations.patch
new file mode 100644
index 00000000000..44741c0e708
--- /dev/null
+++ b/pkgs/tools/misc/qmake2cmake/fix-locations.patch
@@ -0,0 +1,36 @@
+diff --git a/src/qmake2cmake/condition_simplifier_cache.py b/src/qmake2cmake/condition_simplifier_cache.py
+index 86c8e83..9d1ac00 100755
+--- a/src/qmake2cmake/condition_simplifier_cache.py
++++ b/src/qmake2cmake/condition_simplifier_cache.py
+@@ -29,8 +29,7 @@ def get_current_file_path() -> str:
+ 
+ 
+ def get_cache_location() -> str:
+-    this_file = get_current_file_path()
+-    dir_path = os.path.dirname(this_file)
++    dir_path = os.getcwd()
+     cache_path = os.path.join(dir_path, ".pro2cmake_cache", "cache.json")
+     return cache_path
+ 
+diff --git a/src/qmake2cmake/run_pro2cmake.py b/src/qmake2cmake/run_pro2cmake.py
+index fd3e11a..bdbadb0 100755
+--- a/src/qmake2cmake/run_pro2cmake.py
++++ b/src/qmake2cmake/run_pro2cmake.py
+@@ -194,7 +194,6 @@ def run(all_files: typing.List[str], pro2cmake: str, args: argparse.Namespace) -
+     ) -> typing.Tuple[int, str, str]:
+         filename, index, total = data
+         pro2cmake_args = []
+-        pro2cmake_args.append(sys.executable)
+         pro2cmake_args.append(pro2cmake)
+         if args.min_qt_version:
+             pro2cmake_args += ["--min-qt-version", args.min_qt_version]
+@@ -257,8 +256,7 @@ def run(all_files: typing.List[str], pro2cmake: str, args: argparse.Namespace) -
+ def main() -> None:
+     args = parse_command_line()
+ 
+-    script_path = os.path.dirname(os.path.abspath(__file__))
+-    pro2cmake = os.path.join(script_path, "pro2cmake.py")
++    pro2cmake = os.path.join(os.path.dirname(sys.argv[0]), "qmake2cmake")
+     base_path = args.path
+ 
+     all_files = find_all_pro_files(base_path, args)