Opened 11 years ago
Closed 11 years ago
#41411 closed defect (worksforme)
py27-spatialite: IndexError: list index out of range
Reported by: | stanimura | Owned by: | anddam (Andrea D'Amore) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | Cc: | stuff@…, svohara@…, petrrr | |
Port: | py27-spatialite |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
py27-spatialite failes to build.
0SX 10.9, xcode 5.0.2, MacPorts 2.2.1.
$ sudo port clean --all py27-spatialite && sudo port upgrade py27-spatialite [snip] ---> Building py27-spatialite Error: org.macports.build for port py27-spatialite returned: command execution failed
Attachments (1)
Change History (9)
Changed 11 years ago by stanimura
comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Description: | modified (diff) |
---|---|
Owner: | changed from macports-tickets@… to and.damore@… |
Summary: | py27-spatialite failes to build → py27-spatialite: IndexError: list index out of range |
comment:2 Changed 11 years ago by stuff@…
Cc: | stuff@… added |
---|
comment:4 Changed 11 years ago by svohara@…
The problem with the current py27-spatialite port is that at one step in running the setup.py, the script looks to download the latest version of libspatialite-amalgamation-{VER}.zip from the hosting website. There are two problems in the code for doing this, as I detail below. The problems I found are located in the get_amalgamation() function below.
def get_amalgamation(): """Download the Spatialite amalgamation if it isn't there, already.""" if os.path.exists(AMALGAMATION_ROOT): return os.mkdir(AMALGAMATION_ROOT) print "Downloading amalgation." # find out what's current amalgamation ZIP file download_page = urllib.urlopen('''"http://www.gaia-gis.it/spatialite-2.3.1/sources.html"''').read() pattern = re.compile("(libspatialite-amalgamation.*?\.zip)") download_file = pattern.findall(download_page)[0] amalgamation_url = "http://www.gaia-gis.it/spatialite-2.3.1/" + download_file zip_dir = string.replace(download_file,'.zip','') # and download it urllib.urlretrieve(amalgamation_url, "tmp.zip")
1) The base url of the download page has changed. The correct url seems to be as follows: http://www.gaia-gis.it/gaia-sins/libspatialite-sources/. This affects the line of code starting with download_page = ..., as well as amalgamation_url = ... The result of this error is that the pattern.findall() function returns an empty list, and thus we get the invalid index exception.
2) The regular expression finds all zip files starting with "libspatialite-amalgamation", which returns results like the following on the webpage I retrieved from the updated url.
['libspatialite-amalgamation-2.3.0.zip', 'libspatialite-amalgamation-2.3.0.zip', 'libspatialite-amalgamation-2.3.1.zip', 'libspatialite-amalgamation-2.3.1.zip', 'libspatialite-amalgamation-2.4.0-3.zip', 'libspatialite-amalgamation-2.4.0-3.zip', 'libspatialite-amalgamation-2.4.0-4.zip', 'libspatialite-amalgamation-2.4.0-4.zip', 'libspatialite-amalgamation-2.4.0-5.zip', 'libspatialite-amalgamation-2.4.0-5.zip', 'libspatialite-amalgamation-2.4.0.zip', 'libspatialite-amalgamation-2.4.0.zip', 'libspatialite-amalgamation-3.0.0-beta.zip', 'libspatialite-amalgamation-3.0.0-beta.zip', 'libspatialite-amalgamation-3.0.0-beta1a.zip', 'libspatialite-amalgamation-3.0.0-beta1a.zip', 'libspatialite-amalgamation-3.0.0-beta1b.zip', 'libspatialite-amalgamation-3.0.0-beta1b.zip', 'libspatialite-amalgamation-3.0.0-stable.zip', 'libspatialite-amalgamation-3.0.0-stable.zip', 'libspatialite-amalgamation-3.0.1.zip', 'libspatialite-amalgamation-3.0.1.zip']
However, in the code, the first entry in this list is taken as the "current" amalgamation zip file, which by looking at the version numbers is wrong. Even after fixing the download and amalgamation urls, you still have the problem that 2.3.0 will always be downloaded, even though it appears there is a 2.4.0 version, as well as 3.x. Without knowing more, I don't know which is the correct version for compatibility with the rest of the port.
3) In addition, there is a spelling issue in the print statement which follows the os.mkdir(AMALGAMATION_ROOT). The print statement outputs: 'amalgation' instead of 'amalgamation'. Obviously this is not a functional defect, but you may wish to correct the spelling mistake in the same commit.
comment:6 Changed 11 years ago by petrrr
Note that there seem to be "updated" versions of py-spatialite available: https://pypi.python.org/pypi/pyspatialite.
I understand that this port uses pyspatialite 2.6.2-spatialite.2.3.1, so maybe this might relevant here to cope with this problem.
comment:7 Changed 11 years ago by anddam (Andrea D'Amore)
The port has been silently updated to 3.0.1-alpha-0 in r114142, please check and see if you still have the issue.
I can build py27-spatialite correctly now so I'm closing this ticket as worksforme.
Reopen it if you still have the same issue, submit a new one if you have a different issue.
comment:8 Changed 11 years ago by anddam (Andrea D'Amore)
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Cc Me!