From 9f5d340d1ef627e6d9350cf31b89e62868f30b02 Mon Sep 17 00:00:00 2001 From: klea Date: Thu, 11 Dec 2025 19:45:30 +0000 Subject: try to make scripts work in nix the wrapper is annoying me --- pkgs/default.nix | 3 ++- pkgs/pywikibot-scripts/default.nix | 22 +++++++++++----------- pkgs/pywikibot-scripts/setup.py | 18 ++++++++++++++++++ pkgs/pywikibot/default.nix | 7 +++++++ pkgs/shell/default.nix | 8 +++----- pywb/python-import-path/pywikibot_scripts | 1 - pywikibot-core | 2 +- user-config.py | 4 +--- 8 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 pkgs/pywikibot-scripts/setup.py create mode 100644 pkgs/pywikibot/default.nix delete mode 120000 pywb/python-import-path/pywikibot_scripts diff --git a/pkgs/default.nix b/pkgs/default.nix index fc1a96c..aee22c3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -5,7 +5,8 @@ lib.makeScope newScope (self: { /*example = self.callPackage ./example { };*/ pywikibot-scripts = self.callPackage ./pywikibot-scripts { }; + pywikibot = self.callPackage ./pywikibot { pywikibot-scripts = self.pywikibot-scripts; }; - shell = self.callPackage ./shell { pywikibot-scripts = self.pywikibot-scripts; }; + shell = self.callPackage ./shell { pywikibot = self.pywikibot; }; }) diff --git a/pkgs/pywikibot-scripts/default.nix b/pkgs/pywikibot-scripts/default.nix index d5ea238..584ad28 100644 --- a/pkgs/pywikibot-scripts/default.nix +++ b/pkgs/pywikibot-scripts/default.nix @@ -1,34 +1,34 @@ { lib, fetchgit, + python3, python3Packages, + stdenv, }: python3Packages.buildPythonPackage rec { - pname = "pywikibot-scripts"; + pname = "scripts"; version = "10.7.0"; - format = "pyproject"; + pyproject = true; + build-system = [ python3Packages.setuptools ]; disabled = python3Packages.pythonOlder "3.8"; src = fetchgit { url = "https://gerrit.wikimedia.org/r/pywikibot/core"; rev = "f1b4b4d0cfbc199c36fb72570425328daa93b067"; - sparseCheckout = [ "pywikibot/scripts" "scripts" ]; fetchSubmodules = true; - hash = "sha256-MXwrn3WLWmddZRKNryELDRlKmqCqj/6WGDJJbnRAiZs="; + hash = "sha256-L/Yz9yidpTV7WCqHs2L6lFw/CpQyZ1UNd+NpMLJT0Hs="; }; - propagatedBuildInputs = [ - python3Packages.mwparserfromhell - python3Packages.requests - python3Packages.setuptools - ]; + postPatch = '' + rm pyproject.toml setup.py + cp ${./setup.py} ./setup.py + ''; - # Tests attempt to install a tool using pip, which fails due to the sandbox doCheck = false; - pythonImportsCheck = [ "pywikibot.scripts" ]; + pythonImportsCheck = [ "scripts" ]; meta = { description = "Python MediaWiki bot framework scripts"; diff --git a/pkgs/pywikibot-scripts/setup.py b/pkgs/pywikibot-scripts/setup.py new file mode 100644 index 0000000..7f00ffc --- /dev/null +++ b/pkgs/pywikibot-scripts/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup(**{ + 'name': 'scripts', + 'version': '0.0.0', + 'description': 'Scripts from pywikibot', + 'long_description': None, + 'author': None, + 'author_email': None, + 'maintainer': None, + 'maintainer_email': None, + 'url': None, + 'packages': ['scripts'], + 'package_data': {'': ['*']}, + 'install_requires': [], + 'entry_points': {}, + 'python_requires': '', +}) diff --git a/pkgs/pywikibot/default.nix b/pkgs/pywikibot/default.nix new file mode 100644 index 0000000..2be3bcb --- /dev/null +++ b/pkgs/pywikibot/default.nix @@ -0,0 +1,7 @@ +{ python3Packages +, pywikibot-scripts +}: + +python3Packages.pywikibot.overridePythonAttrs (old: { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ pywikibot-scripts ]; +}) diff --git a/pkgs/shell/default.nix b/pkgs/shell/default.nix index 9dfba08..85fa3a7 100644 --- a/pkgs/shell/default.nix +++ b/pkgs/shell/default.nix @@ -7,7 +7,7 @@ , fossil , git , internetarchive -, pywikibot-scripts +, pywikibot }: mkShellNoCC { @@ -15,11 +15,9 @@ mkShellNoCC { (python3.withPackages (p: [ p.requests p.lxml - p.pywikibot - pywikibot-scripts + pywikibot ])) - python3Packages.pywikibot - pywikibot-scripts + pywikibot websocat # connect to websocket jq libfaketime # used by my fossil script diff --git a/pywb/python-import-path/pywikibot_scripts b/pywb/python-import-path/pywikibot_scripts deleted file mode 120000 index 2042976..0000000 --- a/pywb/python-import-path/pywikibot_scripts +++ /dev/null @@ -1 +0,0 @@ -../../pywikibot-core/scripts \ No newline at end of file diff --git a/pywikibot-core b/pywikibot-core index f1b4b4d..71e1ef3 160000 --- a/pywikibot-core +++ b/pywikibot-core @@ -1 +1 @@ -Subproject commit f1b4b4d0cfbc199c36fb72570425328daa93b067 +Subproject commit 71e1ef3161cc025d60869e3ff6d90d77dced0c6f diff --git a/user-config.py b/user-config.py index fd59df8..768ef0b 100644 --- a/user-config.py +++ b/user-config.py @@ -1,8 +1,6 @@ -import os, sys -sys.path.insert(0, os.getcwd()+"/pywb/python-import-path") +import os console_encoding = 'utf-8' user_families_paths = [ 'pywb/families' ] -user_script_paths = [ 'pywikibot-core/scripts' ] password_file = "user-password.cfg" mylang = 'en' family = 'ArchiveTeam' -- cgit v1.3.1-10-gc9f91