From 26349bf8d36daab9eeeb61f259cb6caea01bb49f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 4 Apr 2014 17:30:10 +0100 Subject: [PATCH] Work around pip issue #1630 breaking 'pip -e git+url' https://github.com/pypa/pip/issues/1630 Fixes ticket #18 (opened in 2010!) Conflicts: NEWS --- NEWS | 2 ++ setup.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 1dc3a5d5..6746d379 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ What's new in psycopg 2.4.7 --------------------------- + - Work around `pip issue #1630 `__ + making installation via ``pip -e git+url`` impossible (:ticket:`#18`). - Properly cleanup memory of broken connections (ticket #142). - Fixed build on Solaris 10 and 11 where the round() function is already declared (:ticket:`#146`). diff --git a/setup.py b/setup.py index 0abc51eb..9d46b794 100644 --- a/setup.py +++ b/setup.py @@ -500,9 +500,11 @@ you probably need to install its companion -dev or -devel package.""" # generate a nice version string to avoid confusion when users report bugs version_flags.append('pq3') # no more a choice + for have in parser.get('build_ext', 'define').split(','): if have == 'PSYCOPG_EXTENSIONS': version_flags.append('ext') + if version_flags: PSYCOPG_VERSION_EX = PSYCOPG_VERSION + " (%s)" % ' '.join(version_flags) else: @@ -523,6 +525,13 @@ if parser.has_option('build_ext', 'static_libpq'): else: static_libpq = 0 +# And now... explicitly add the defines from the .cfg files. +# Looks like setuptools or some other cog doesn't add them to the command line +# when called e.g. with "pip -e git+url'. This results in declarations +# duplicate on the commandline, which I hope is not a problem. +for define in parser.get('build_ext', 'define').split(','): + define_macros.append((define, '1')) + # build the extension sources = [ os.path.join('psycopg', x) for x in sources]