Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moar Psycopg2 #1162

Merged
merged 21 commits into from
Aug 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions recipes/libpq/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set version = "9.5.3" %}

package:
name: libpq
version: {{ version }}

build:
number: 0
skip: True # [win]
# features:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are going to try Windows right after feedstocking we can leave these here. No need to remove them now.

Copy link
Member Author

@msarahan msarahan Aug 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was my hope. I don't know how quickly I'll get to it - still fighting postgresql build on win.

# - vc9 # [win and py27]
# - vc10 # [win and py34]
# - vc14 # [win and py35]
always_include_files:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious is this a new things or old and I never saw it before b/c I am lazy and I did not read the docs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not new, but not commonly used. This is what you do when you want to create a sort of sub-package, as I did here with libpq. The files originally come from postgresql, but then I force them to be included in the new package (they would not be, otherwise, since they exist before the build starts.)

- lib/libpq.so.5.8 # [linux]
- lib/libpq.so.5 # [linux]
- lib/libpq.so # [linux]
- lib/libpq.5.8.dylib # [osx]
- lib/libpq.5.dylib # [osx]
- lib/libpq.dylib # [osx]
- bin/pg_config # [unix]
- Library/bin/libpq.dll # [win]
- Library/bin/pg_config.exe # [win]

requirements:
build:
# - vc 9 # [win and py27]
# - vc 10 # [win and py34]
# - vc 14 # [win and py35]
- postgresql {{ version }}
# run:
# - vc 9 # [win and py27]
# - vc 10 # [win and py34]
# - vc 14 # [win and py35]

test:
commands:
- pg_config
- test -f $PREFIX/lib/libpq.so.5.8 # [linux]
- test -f $PREFIX/lib/libpq.so.5 # [linux]
- test -f $PREFIX/lib/libpq.so # [linux]
- test -f $PREFIX/lib/libpq.5.8.dylib # [osx]
- test -f $PREFIX/lib/libpq.5.dylib # [osx]
- test -f $PREFIX/lib/libpq.dylib # [osx]

about:
home: http://www.postgresql.org/
license: PostgreSQL license (http://www.postgresql.org/about/licence/)
summary: The postgres runtime libraries and utilities (not the server itself)

extra:
recipe-maintainers:
- msarahan
- ocefpaf
2 changes: 2 additions & 0 deletions recipes/psycopg2/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"%PYTHON%" setup.py install
if errorlevel 1 exit 1
14 changes: 14 additions & 0 deletions recipes/psycopg2/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

export LDFLAGS="${LDFLAGS} -L$PREFIX/lib -lssl"

$PYTHON setup.py install

if [[ `uname` == 'Darwin' ]]; then
PG_LIB=$(pg_config --libdir)
for LIBRARY in `find ${SP_DIR}/${PKG_NAME} -name "*.so"`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is creating .so and not dylib, right? I know that happens in some python modules, but I never saw it (no Mac here). Just want to be sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I didn't write that part. @jseabold, can you comment on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked the Travis-CI log and that is correct.

https://travis-ci.org/conda-forge/staged-recipes/jobs/149016531#L867

do
install_name_tool -change libssl.1.0.0.dylib @rpath/libssl.1.0.0.dylib $LIBRARY
install_name_tool -change libcrypto.1.0.0.dylib @rpath/libcrypto.1.0.0.dylib $LIBRARY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Continuum would build openssl with conda-build this wouldn't be needed (c.f. ContinuumIO/anaconda-issues#498).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming these files are part of a different package (otherwise conda build would just do this itself after the build is complete). Assuming that is correct, shouldn't you break the hard links here? It doesn't matter for conda-forge, but if someone tries to build this recipe on their own machine, this will write into the package cache. Sorry if I'm missing something here.

Copy link
Member

@jakirkham jakirkham Aug 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter for conda-forge, but if someone tries to build this recipe on their own machine, this will write into the package cache.

👍 Absolutely correct. Should be a simple copy shuffle to break the hard links.

Could you please raise the issue on the feedstock though as this is already merged or better yet propose the change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they actually from a separate package? Based on the loop, it looks like they are part of this package, but if that's the case, why are these lines needed?

done
fi
13 changes: 13 additions & 0 deletions recipes/psycopg2/have_openssl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git setup.cfg setup.cfg
index 90a47dd..1057dc1 100644
--- setup.cfg
+++ setup.cfg
@@ -21,7 +21,7 @@ use_pydatetime=1
# For Windows only:
# Set to 1 if the PostgreSQL library was built with OpenSSL.
# Required to link in OpenSSL libraries and dependencies.
-have_ssl=0
+have_ssl=1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many will be pleased 😄


# Statically link against the postgresql client library.
#static_libpq=1
43 changes: 43 additions & 0 deletions recipes/psycopg2/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% set version = "2.6.1" %}

package:
name: psycopg2
version: {{ version }}

source:
fn: psycopg2-{{ version }}.tar.gz
url: https://pypi.python.org/packages/source/p/psycopg2/psycopg2-{{ version }}.tar.gz
md5: 842b44f8c95517ed5b792081a2370da1
patches:
- have_openssl.patch

build:
number: 0
# FIXME: until we solve the postgresql package.
skip: True # [win]

requirements:
build:
- python
- postgresql
- openssl 1.0.*
run:
# libpq is a repackaging of only the library to connect to postgres
- libpq
- python
- openssl 1.0.*

test:
imports:
- psycopg2
- psycopg2._psycopg

about:
home: http://initd.org/psycopg/
license: LGPL, BSD-like, ZPL
summary: Python-PostgreSQL Database Adapter

extra:
recipe-maintainers:
- msarahan
- ocefpaf