Opened 4 years ago

Closed 4 years ago

#5473 closed defect (fixed)

toolshed python package parsing cannot handle quotes

Reported by: wolfgang.lugmayr@… Owned by: Greg Couch
Priority: high Milestone: 1.3
Component: Tool Shed Version:
Keywords: Cc: Tom Goddard, pett
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Dear developers,

I am developing a ChimeraX plugin which uses the pip package pyqtgraph as dependency.
With the version 0.12.3 it has a problem which stops ChimeraX from starting.

in line 566 is a split by ','
/usr/libexec/UCSF-ChimeraX/lib/python3.8/site-packages/chimerax/core/toolshed/installed.py

The RECORD file contents have more than 3 commas in the line below, but the text is under quotes"
vi $HOME/.local/share/ChimeraX/1.2/site-packages/pyqtgraph-0.12.3.dist-info/RECORD
"pyqtgraph/colors/maps/CC0 legal code - applies to virids, magma, plasma, inferno and cividiis.txt",sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048

Unfortunatly you do not handle text under quotes as one unit, so the parsing by ',' fails and ChimeraX does not start.

Cheers,
Wolfgang Lugmayr

-- 
Multi-User Cryo-EM Facility
@ Centre for Structral Systems Biology (CSSB)
@ Deutsches Elektronen-Synchrotron (DESY)
Notkestrasse 85 Gebäude 15 (E.247)
22607 Hamburg, Germany
Tel.: +49 40 8998-87706
Email: wolfgang.lugmayr@cssb-hamburg.de
http://www.cssb-hamburg.de/


Change History (2)

comment:1 by pett, 4 years ago

Cc: Tom Goddard pett added
Component: UnassignedTool Shed
Milestone: 1.3
Owner: set to Greg Couch
Platform: all
Priority: normalhigh
Project: ChimeraX
Status: newassigned

comment:2 by Greg Couch, 4 years ago

Resolution: fixed
Status: assignedclosed

This will be fixed in the next daily build and the 1.3 release candidate. Here is the patch if you don't want to wait:

--- a/src/core/toolshed/installed.py
+++ b/src/core/toolshed/installed.py
@@ -557,13 +557,16 @@ def _get_installed_packages(d, logger):

     For example, 'foo.bar' from foo/bar/__init__.py becomes ('foo', 'bar')
     """
+    import csv
     record_file = "RECORD"
     if not d.has_metadata(record_file):
         logger.warning("cannot get installed file list for %r" % d.project_name)
         return []
     packages = []
-    for line in d.get_metadata_lines(record_file):
-        path, hash, size = line.split(',')
+    for row in csv.reader(d.get_metadata_lines(record_file)):
+        if len(row) != 3:
+            continue
+        path = row[0]
         if not path.endswith('/__init__.py'):
             continue
         parts = path.split('/')
Note: See TracTickets for help on using tickets.