From 9982d79d74c20704cc987cd4ca63cb0934dfb8b1 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 13 Mar 2019 09:02:04 +0000 Subject: [PATCH 1/2] added reasoning behind the setup.py unexpected location check --- cython/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cython/README.md b/cython/README.md index a524ac04c..b9ce2f012 100644 --- a/cython/README.md +++ b/cython/README.md @@ -24,6 +24,8 @@ export PYTHONPATH=$PYTHONPATH: - To install system-wide: run `make install` then navigate to `GTSAM_CYTHON_INSTALL_PATH` and run `python setup.py install` - (the same command can be used to install into a virtual environment if it is active) - note: if you don't want gtsam to install to a system directory such as `/usr/local`, pass `-DCMAKE_INSTALL_PREFIX="./install"` to cmake to install gtsam to a subdirectory of the build directory. + - if you run `setup.py` from the build directory rather than the installation directory, the script will warn you with the message: `setup.py is being run from an unexpected location`. + Before `make install` is run, not all the components of the package have been copied across, so running `setup.py` from the build directory would result in an incomplete package. UNIT TESTS ========== From 173191621eee0c3ae0fde428e547335f540fe3ac Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 13 Mar 2019 09:45:56 +0000 Subject: [PATCH 2/2] made it possible to disable the setup.py check --- cython/setup.py.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index b7b0b7bc5..d6af28762 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -5,13 +5,13 @@ try: except ImportError: from distutils.core import setup, find_packages - -script_path = os.path.abspath(os.path.realpath(__file__)) -install_path = os.path.abspath(os.path.realpath(os.path.join('${GTSAM_CYTHON_INSTALL_PATH}', 'setup.py'))) -if script_path != install_path: - print('setup.py is being run from an unexpected location: "{}"'.format(script_path)) - print('please run `make install` and run the script from there') - sys.exit(1) +if 'SETUP_PY_NO_CHECK' not in os.environ: + script_path = os.path.abspath(os.path.realpath(__file__)) + install_path = os.path.abspath(os.path.realpath(os.path.join('${GTSAM_CYTHON_INSTALL_PATH}', 'setup.py'))) + if script_path != install_path: + print('setup.py is being run from an unexpected location: "{}"'.format(script_path)) + print('please run `make install` and run the script from there') + sys.exit(1) packages = find_packages()