-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hi,
As initially reported in Debian bug #1083762, scoary depends on pkg_resources which is deprecated and on a course to be removed. I intend to workaround the issue with the below patch, but I'm not 100% it is suitable in every situations, notably outside Debian context. Anyway, in case you find something useful:
--- scoary.orig/scoary/GUI.py
+++ scoary/scoary/GUI.py
@@ -61,7 +61,7 @@
except ImportError:
sys.exit("Could not find the main Scoary executable")
-from pkg_resources import resource_string, resource_filename
+from importlib.metadata import distribution
class ScoaryGUI(Tkinter.Tk):
"""
@@ -617,11 +617,12 @@
"""
Sets all variables corresponding to --test in the methods script
"""
+ scoary_dist = distribution('scoary')
self.GPAentryVariable.set(
- str(os.path.join(resource_filename(__name__, 'exampledata'),
+ str(os.path.join(scoary_dist.locate_file('scoary'), 'exampledata',
'Gene_presence_absence.csv')))
self.TraitsentryVariable.set(
- str(os.path.join(resource_filename(__name__, 'exampledata'),
+ str(os.path.join(scoary_dist.locate_file('scoary'), 'exampledata',
'Tetracycline_resistance.csv')))
self.TreeentryVariable.set("")
self.RestrictVariable.set("")
--- scoary.orig/scoary/methods.py
+++ scoary/scoary/methods.py
@@ -27,7 +27,7 @@
#import scoary
import os
-from pkg_resources import resource_string, resource_filename
+from importlib.metadata import distribution
#SCOARY_VERSION = scoary.__version__
SCOARY_VERSION = __version__
@@ -69,9 +69,10 @@
if args.test:
args.correction = ['I','EPW']
args.delimiter = ','
- args.genes = os.path.join(
- resource_filename(__name__, 'exampledata'),
- 'Gene_presence_absence.csv')
+ scoary_dist = distribution('scoary')
+ args.genes = os.path.join(scoary_dist.locate_file('scoary'),
+ 'exampledata',
+ 'Gene_presence_absence.csv')
args.grabcols = []
args.max_hits = None
args.newicktree = None
@@ -82,9 +83,9 @@
args.restrict_to = None
args.start_col = 15
args.threads = 4
- args.traits = os.path.join(
- resource_filename(__name__, 'exampledata'),
- 'Tetracycline_resistance.csv')
+ args.traits = os.path.join(scoary_dist.locate_file('scoary'),
+ 'exampledata',
+ 'Tetracycline_resistance.csv')
args.upgma_tree = True
args.write_reduced = False
args.no_time = FalseHave a nice day, :)
Étienne.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels