tbabej / taskpirate

A pluggable system for tasklib based TaskWarrior hooks. Faster, less boilerplate code!
Other
46 stars 10 forks source link

taskpirate uses deprecated imp #6

Closed heiderich closed 4 years ago

heiderich commented 5 years ago

taskpirate uses the module imp: https://github.com/tbabej/taskpirate/blob/c0d91dae27c2a1f73ed9fc103f7fbfcfc3ca0ae9/on-modify-pirate#L4 This module is deprecated since version 3.4 (https://docs.python.org/3/library/imp.html). I propose to consider switching to importlib.

NGenetzky commented 4 years ago

Here is a patch to ignore it until action is taken.

From 3bfa1e685e14283ba901ed3b576a8e629684e15d Mon Sep 17 00:00:00 2001
From: Nathan Genetzky <nathan@genetzky.us>
Date: Tue, 4 Aug 2020 08:59:15 -0500
Subject: [PATCH] python: Add shebang for 'ignore::DeprecationWarning'

---
 on-add-pirate    | 7 ++++++-
 on-modify-pirate | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/on-add-pirate b/on-add-pirate
index 9fae1c4..d8ee94f 100755
--- a/on-add-pirate
+++ b/on-add-pirate
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/usr/bin/env -S python3 -W ignore::DeprecationWarning
+#
+# Although not exactly portable, starting with coreutils 8.30: The
+# -S/--split-string options enable using multiple arguments on the first one of
+# scripts (shebang line, ‘#!’).
+# [ref](https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts)

 import glob
 import imp
diff --git a/on-modify-pirate b/on-modify-pirate
index b7b4986..298e82a 100755
--- a/on-modify-pirate
+++ b/on-modify-pirate
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/usr/bin/env -S python3 -W ignore::DeprecationWarning
+#
+# Although not exactly portable, starting with coreutils 8.30: The
+# -S/--split-string options enable using multiple arguments on the first one of
+# scripts (shebang line, ‘#!’).
+# [ref](https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts)

 import glob
 import imp
-- 
2.26.2
trych commented 4 years ago

Here is a patch to ignore it until action is taken.

Thanks! Would be great if this could be generally fixed though. As a python novice, this is over my head unfortunately. Nvm, I overlooked heiderich's PR above.