Skip to content

Commit 6e4bc57

Browse files
committed
BUG20217174: Fix install command honouring --install-lib when given
We add an extra fix for when either one of --install-lib or --install-purelib is given. When installing the C Extension, however, --install-lib has to be used.
1 parent b666e5a commit 6e4bc57

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/cpy_distutils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# MySQL Connector/Python - MySQL driver written in Python.
2-
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
33

44
# MySQL Connector/Python is licensed under the terms of the GPLv2
55
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -416,8 +416,9 @@ class BuildExtStatic(BuildExtDynamic):
416416
user_options = build_ext.user_options + CEXT_OPTIONS
417417

418418
def finalize_options(self):
419-
self.set_undefined_options('install',
420-
('with_mysql_capi', 'with_mysql_capi'))
419+
if not self.with_mysql_capi:
420+
self.set_undefined_options('install',
421+
('with_mysql_capi', 'with_mysql_capi'))
421422

422423
build_ext.finalize_options(self)
423424
self.connc_lib = os.path.join(self.build_temp, 'connc', 'lib')
@@ -514,8 +515,6 @@ def initialize_options(self):
514515
self.static = None
515516

516517
def finalize_options(self):
517-
install.finalize_options(self)
518-
519518
if self.static:
520519
self.distribution.cmdclass['build_ext'] = BuildExtStatic
521520

@@ -529,13 +528,14 @@ def finalize_options(self):
529528
build.with_mysql_capi = self.with_mysql_capi
530529
self.need_ext = True
531530

532-
def run(self):
533531
if not self.need_ext:
534532
remove_cext(self.distribution)
535-
# We install pure Python code in purelib location when no
536-
# extension is build
537-
if not self.install_lib or self.install_purelib:
538-
self.install_lib = self.install_purelib
533+
534+
install.finalize_options(self)
535+
536+
def run(self):
537+
if not self.need_ext:
538+
log.info("Not Installing C Extension")
539539
else:
540-
log.info("installing C Extension")
540+
log.info("Installing C Extension")
541541
install.run(self)

0 commit comments

Comments
 (0)