Opened 12 years ago

Last modified 8 years ago

#32706 new defect

py-pyodbc: can't find MacPorts ODBC drivers

Reported by: bpanulla (Brian Panulla) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: haspatch Cc: petrrr, kurthindenburg (Kurt Hindenburg)
Port: py-pyodbc

Description (last modified by ryandesign (Ryan Carsten Schmidt))

The current version of py27-odbc doesn't find ODBC drivers in /opt/local, failing with the classic and super-informative 'Data source name not found, and no default driver specified'. I've tried it with both the mysql-odbc-connector port and my psqlODBC port (still waiting to be approved).

I can connect to the data sources using the MacPorts unixODBC isql client without issue, so this is definitely a problem in pyodbc. I *think* this was previously working under Snow Leopard, but I can't be sure and I don't have a system running that anymore.

I got a hint to the problem from a Stack Overflow question/answer that led me to a solution.

Attached are an updated Portfile and a new setup.py.patch that adds MacPorts library and include paths to the build process.

Alas, I've also included an upgrade to pyodbc 2.1.11. The current version (2.1.8) is quite old and I couldn't see how to accomplish what I needed to do against the old codebase. I f someone who knows more about the build process can tease these two patches apart into one, go for it.

Attachments (3)

Portfile (1.0 KB) - added by bpanulla (Brian Panulla) 12 years ago.
New Portfile
setup.py.patch (507 bytes) - added by bpanulla (Brian Panulla) 12 years ago.
New patch that fixes include/library paths.
pyodbc-2.1.11.patch (2.4 KB) - added by bpanulla (Brian Panulla) 12 years ago.
Full unified patch of the change relative to current MacPorts trunk.

Download all attachments as: .zip

Change History (11)

Changed 12 years ago by bpanulla (Brian Panulla)

Attachment: Portfile added

New Portfile

Changed 12 years ago by bpanulla (Brian Panulla)

Attachment: setup.py.patch added

New patch that fixes include/library paths.

comment:1 Changed 12 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to singingwolfboy@…

Please supply a unified diff of the portfile so we can easily see the changes you made.

Changed 12 years ago by bpanulla (Brian Panulla)

Attachment: pyodbc-2.1.11.patch added

Full unified patch of the change relative to current MacPorts trunk.

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Your patch hardcodes /opt/local; you must instead arrange to use the current value of ${prefix}.

comment:3 Changed 12 years ago by bpanulla (Brian Panulla)

Not sure where to start with this. Do you know any ports off hand that have handled this before? It seems like I would need to dynamically create the patch somehow.

comment:4 in reply to:  3 Changed 12 years ago by jmroot (Joshua Root)

Replying to bpanulla@…:

Not sure where to start with this. Do you know any ports off hand that have handled this before? It seems like I would need to dynamically create the patch somehow.

wiki:PortfileRecipes#hardcode_opt_local

comment:5 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added; pyodbc removed
Owner: changed from singingwolfboy@… to macports-tickets@…
Port: py-pyodbc added; py27-odbc removed
Summary: py27-odbc can't find MacPorts ODBC drivers on 10.7py-pyodbc: can't find MacPorts ODBC drivers

Is this still a problem with py-pyodbc 3.0.6?

comment:6 Changed 9 years ago by petrrr

Cc: petr@… added

Cc Me!

comment:7 Changed 8 years ago by kurthindenburg (Kurt Hindenburg)

Cc: khindenburg@… added

Cc Me!

comment:8 Changed 8 years ago by kurthindenburg (Kurt Hindenburg)

IF anyone is interested I have a patch on https://trac.macports.org/ticket/29185 that updates to the recent version and adds that ticket's variants. If you do try it out, let us know the results.

Note: See TracTickets for help on using tickets.