From 54512731e31c90f10b136b4449ffc0abc0217555 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 11:57:05 +0000 Subject: [PATCH 01/20] added setup.py --- cython/CMakeLists.txt | 1 + cython/README.md | 4 +++- cython/setup.py.in | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 cython/setup.py.in diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index e53c0b73e..317fb7e2d 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -33,6 +33,7 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) # Install the custom-generated __init__.py # This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam/__init__.py.in ${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py) + configure_file(${PROJECT_SOURCE_DIR}/cython/setup.py.in ${PROJECT_BINARY_DIR}/cython/setup.py) install_cython_files("${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py" "${GTSAM_CYTHON_INSTALL_PATH}/gtsam") # install scripts and tests install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") diff --git a/cython/README.md b/cython/README.md index 8ba824f8d..78fc7e594 100644 --- a/cython/README.md +++ b/cython/README.md @@ -17,10 +17,12 @@ named **gtsam_eigency**, to interface between C++'s Eigen and Python's numpy. The wrapped module will be installed to `GTSAM_CYTHON_INSTALL_PATH`, which is by default: `/cython` -- Modify your `PYTHONPATH` to include the `GTSAM_CYTHON_INSTALL_PATH`: +- To use the library without installing system-wide: modify your `PYTHONPATH` to include the `GTSAM_CYTHON_INSTALL_PATH`: ```bash export PYTHONPATH=$PYTHONPATH: ``` +- To install system-wide: 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) UNIT TESTS ========== diff --git a/cython/setup.py.in b/cython/setup.py.in new file mode 100644 index 000000000..6a2009913 --- /dev/null +++ b/cython/setup.py.in @@ -0,0 +1,28 @@ +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +setup( + name='gtsam', + + description='Georgia Tech Smoothing And Mapping library', + url='https://bitbucket.org/gtborg/gtsam', + version='${GTSAM_VERSION_STRING}', # https://www.python.org/dev/peps/pep-0440/ + license='Simplified BSD license', + keywords='slam sam', + long_description=open('${PROJECT_SOURCE_DIR}/README.md', 'r').read(), + # https://pypi.org/pypi?%3Aaction=list_classifiers + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Education', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', + ], + + packages=['gtsam', 'gtsam_eigency'], + install_requires=open('${PROJECT_SOURCE_DIR}/cython/requirements.txt', 'r').read().splitlines() +) From f6af989e6776aee45d968f9c7eada5f74e88f63f Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 15:15:20 +0000 Subject: [PATCH 02/20] setup.py install .so files --- cython/setup.py.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index 6a2009913..e99bd5de1 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -1,8 +1,15 @@ +import os try: from setuptools import setup except ImportError: from distutils.core import setup + +packages = ['gtsam', 'gtsam_eigency'] +if ${GTSAM_BUILD_UNSTABLE}: + packages += 'gtsam_unstable' + + setup( name='gtsam', @@ -23,6 +30,10 @@ setup( 'Programming Language :: Python :: 3', ], - packages=['gtsam', 'gtsam_eigency'], + packages=packages, + package_data={package: + [f for f in os.listdir(package) if os.path.splitext(f)[1] == '.so'] + for package in packages + }, install_requires=open('${PROJECT_SOURCE_DIR}/cython/requirements.txt', 'r').read().splitlines() ) From a62197ec6ecc98ff092bbf43b4b7bfa4dc490999 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 15:34:09 +0000 Subject: [PATCH 03/20] gtsam_unstable as a separate package --- cython/CMakeLists.txt | 7 ++----- cython/gtsam/__init__.py | 1 + cython/gtsam/__init__.py.in | 2 -- cython/gtsam_unstable/__init__.py | 2 ++ cython/setup.py.in | 10 +++------- 5 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 cython/gtsam/__init__.py delete mode 100644 cython/gtsam/__init__.py.in create mode 100644 cython/gtsam_unstable/__init__.py diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index 317fb7e2d..c2d38fd47 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -22,19 +22,16 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) set(GTSAM_UNSTABLE_IMPORT "from .gtsam_unstable import *") wrap_and_install_library_cython("../gtsam_unstable/gtsam_unstable.h" # interface_header "from gtsam.gtsam cimport *" # extra imports - "${GTSAM_CYTHON_INSTALL_PATH}/gtsam" # install path + "${GTSAM_CYTHON_INSTALL_PATH}/gtsam_unstable" # install path gtsam_unstable # library to link with "gtsam_unstable;gtsam_unstable_header;cythonize_gtsam" # dependencies to be built before wrapping ) - # for some reasons cython gtsam_unstable can't find gtsam/gtsam.pxd without doing this - file(WRITE ${PROJECT_BINARY_DIR}/cython/gtsam_unstable/__init__.py "") endif() # Install the custom-generated __init__.py # This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable - configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam/__init__.py.in ${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py) configure_file(${PROJECT_SOURCE_DIR}/cython/setup.py.in ${PROJECT_BINARY_DIR}/cython/setup.py) - install_cython_files("${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py" "${GTSAM_CYTHON_INSTALL_PATH}/gtsam") + install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}/") # install scripts and tests install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") diff --git a/cython/gtsam/__init__.py b/cython/gtsam/__init__.py new file mode 100644 index 000000000..9bda86efe --- /dev/null +++ b/cython/gtsam/__init__.py @@ -0,0 +1 @@ +from .gtsam import * diff --git a/cython/gtsam/__init__.py.in b/cython/gtsam/__init__.py.in deleted file mode 100644 index 85451c680..000000000 --- a/cython/gtsam/__init__.py.in +++ /dev/null @@ -1,2 +0,0 @@ -from .gtsam import * -${GTSAM_UNSTABLE_IMPORT} diff --git a/cython/gtsam_unstable/__init__.py b/cython/gtsam_unstable/__init__.py new file mode 100644 index 000000000..04ce7f1e0 --- /dev/null +++ b/cython/gtsam_unstable/__init__.py @@ -0,0 +1,2 @@ +from .gtsam_unstable import * + diff --git a/cython/setup.py.in b/cython/setup.py.in index e99bd5de1..e72dbd7c1 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -1,18 +1,14 @@ import os try: - from setuptools import setup + from setuptools import setup, find_packages except ImportError: - from distutils.core import setup + from distutils.core import setup, find_packages -packages = ['gtsam', 'gtsam_eigency'] -if ${GTSAM_BUILD_UNSTABLE}: - packages += 'gtsam_unstable' - +packages = find_packages() setup( name='gtsam', - description='Georgia Tech Smoothing And Mapping library', url='https://bitbucket.org/gtborg/gtsam', version='${GTSAM_VERSION_STRING}', # https://www.python.org/dev/peps/pep-0440/ From fe3003a688a85cb7cdb80511bffec50e138ec2aa Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 15:38:25 +0000 Subject: [PATCH 04/20] install gtsam_unstable __init__.py --- cython/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index c2d38fd47..3dedbeec2 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -34,5 +34,6 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}/") # install scripts and tests install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") + install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam_unstable" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") endif () From c1b048020ee99ee209abe1d35fb0a9aaba3d6ec7 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 15:55:49 +0000 Subject: [PATCH 05/20] fixed bug with detecting nested python packages in setup.py --- cython/setup.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index e72dbd7c1..0a994b18f 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -28,7 +28,7 @@ setup( packages=packages, package_data={package: - [f for f in os.listdir(package) if os.path.splitext(f)[1] == '.so'] + [f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] == '.so'] for package in packages }, install_requires=open('${PROJECT_SOURCE_DIR}/cython/requirements.txt', 'r').read().splitlines() From 88dac759d7e675662919ad8fc8524d741ca81ca4 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 15:57:52 +0000 Subject: [PATCH 06/20] setup.py gets installed into correct directory --- cython/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index 3dedbeec2..d5e8b8fac 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -31,7 +31,7 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) # Install the custom-generated __init__.py # This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable configure_file(${PROJECT_SOURCE_DIR}/cython/setup.py.in ${PROJECT_BINARY_DIR}/cython/setup.py) - install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}/") + install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}") # install scripts and tests install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam_unstable" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") From 0d7b52d99fb47a2aa9131e99567ad0e1b8213a01 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 16:03:51 +0000 Subject: [PATCH 07/20] copy __init__.py before compiling c++ --- cython/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index d5e8b8fac..ca5c0ecfb 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -30,6 +30,8 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) # Install the custom-generated __init__.py # This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable + configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam/__init__.py ${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam_unstable/__init__.py ${PROJECT_BINARY_DIR}/cython/gtsam_unstable/__init__.py COPYONLY) configure_file(${PROJECT_SOURCE_DIR}/cython/setup.py.in ${PROJECT_BINARY_DIR}/cython/setup.py) install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}") # install scripts and tests From d56efcceadb6d9258a6441a0484d6ae85c1ca32f Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 20:32:05 +0000 Subject: [PATCH 08/20] setup.py only installs for the python version it is built for --- cython/setup.py.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index 0a994b18f..0f133f781 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -22,8 +22,7 @@ setup( 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: ${PYTHON_VERSION_MAJOR}', ], packages=packages, From fe9ede47d1956390894175ce6f26b4df66d16e3a Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Fri, 8 Feb 2019 20:32:38 +0000 Subject: [PATCH 09/20] added dlls to package_data --- cython/setup.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index 0f133f781..3161c36e7 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -27,7 +27,7 @@ setup( packages=packages, package_data={package: - [f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] == '.so'] + [f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] in ('.so', '.dll')] for package in packages }, install_requires=open('${PROJECT_SOURCE_DIR}/cython/requirements.txt', 'r').read().splitlines() From 135ef5a0d0647e0d9ef14071c5c27a1b88d951bf Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 13 Feb 2019 14:38:46 +0000 Subject: [PATCH 10/20] baking in requirements and README to setup.py rather than reading at install time --- cython/CMakeLists.txt | 3 +++ cython/setup.py.in | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index ca5c0ecfb..400e96e13 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -28,6 +28,9 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) ) endif() + file(READ "${PROJECT_SOURCE_DIR}/cython/requirements.txt" CYTHON_INSTALL_REQUIREMENTS) + file(READ "${PROJECT_SOURCE_DIR}/README.md" README_CONTENTS) + # Install the custom-generated __init__.py # This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam/__init__.py ${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py COPYONLY) diff --git a/cython/setup.py.in b/cython/setup.py.in index 3161c36e7..0e22dbf11 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -14,7 +14,7 @@ setup( version='${GTSAM_VERSION_STRING}', # https://www.python.org/dev/peps/pep-0440/ license='Simplified BSD license', keywords='slam sam', - long_description=open('${PROJECT_SOURCE_DIR}/README.md', 'r').read(), + long_description='''${README_CONTENTS}''', # https://pypi.org/pypi?%3Aaction=list_classifiers classifiers=[ 'Development Status :: 5 - Production/Stable', @@ -30,5 +30,7 @@ setup( [f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] in ('.so', '.dll')] for package in packages }, - install_requires=open('${PROJECT_SOURCE_DIR}/cython/requirements.txt', 'r').read().splitlines() + install_requires=[line.strip() for line in ''' +${CYTHON_INSTALL_REQUIREMENTS} +'''.splitlines() if len(line) > 0 and not line.strip().startswith('#')] ) From 290aad3372fb9372cef8f852d9c27cb57a4154b3 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 20 Feb 2019 09:03:34 +0000 Subject: [PATCH 11/20] small change to setup.py --- cython/gtsam_unstable/__init__.py | 1 - cython/setup.py.in | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cython/gtsam_unstable/__init__.py b/cython/gtsam_unstable/__init__.py index 04ce7f1e0..3195e6da4 100644 --- a/cython/gtsam_unstable/__init__.py +++ b/cython/gtsam_unstable/__init__.py @@ -1,2 +1 @@ from .gtsam_unstable import * - diff --git a/cython/setup.py.in b/cython/setup.py.in index 0e22dbf11..e631d89c0 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -21,8 +21,12 @@ setup( 'Intended Audience :: Education', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', + 'Operating System :: MacOS', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: ${PYTHON_VERSION_MAJOR}', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', ], packages=packages, @@ -32,5 +36,5 @@ setup( }, install_requires=[line.strip() for line in ''' ${CYTHON_INSTALL_REQUIREMENTS} -'''.splitlines() if len(line) > 0 and not line.strip().startswith('#')] +'''.splitlines() if len(line.strip()) > 0 and not line.strip().startswith('#')] ) From 803c14deb3058e12aa6779c1f9cb4fe7e1764e7d Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 6 Mar 2019 10:15:07 +0000 Subject: [PATCH 12/20] removed unnecessary variable from cmake --- cython/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index 400e96e13..a351ec52b 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -19,7 +19,6 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) # wrap gtsam_unstable if(GTSAM_BUILD_UNSTABLE) add_custom_target(gtsam_unstable_header DEPENDS "../gtsam_unstable/gtsam_unstable.h") - set(GTSAM_UNSTABLE_IMPORT "from .gtsam_unstable import *") wrap_and_install_library_cython("../gtsam_unstable/gtsam_unstable.h" # interface_header "from gtsam.gtsam cimport *" # extra imports "${GTSAM_CYTHON_INSTALL_PATH}/gtsam_unstable" # install path From fcfcceef71bc833bfc9000b487333bf20ad6df26 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Thu, 7 Mar 2019 09:11:16 +0000 Subject: [PATCH 13/20] added gtsam_unstable import back to gtsam --- cython/gtsam/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cython/gtsam/__init__.py b/cython/gtsam/__init__.py index 9bda86efe..724572240 100644 --- a/cython/gtsam/__init__.py +++ b/cython/gtsam/__init__.py @@ -1 +1,19 @@ from .gtsam import * + +import gtsam_unstable + + +def deprecated_wrapper(item, name): + def wrapper(*args, **kwargs): + from warnings import warn + warn('importing the unstable item "{}" from gtsam is deprecated. Please import it from gtsam_unstable.'.format(name)) + return item(*args, **kwargs) + return wrapper + +for name in dir(gtsam_unstable): + if not name.startswith('__'): + item = getattr(gtsam_unstable, name) + if callable(item): + item = deprecated_wrapper(item, name) + globals()[name] = item + From 7161c0461095b92d407a2a40ce76d295a51d9ec6 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Thu, 7 Mar 2019 10:05:02 +0000 Subject: [PATCH 14/20] fixed __init__.py to not crash if gtsam_unstable doesn't exist --- cython/gtsam/__init__.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/cython/gtsam/__init__.py b/cython/gtsam/__init__.py index 724572240..f27c6fa44 100644 --- a/cython/gtsam/__init__.py +++ b/cython/gtsam/__init__.py @@ -1,19 +1,26 @@ from .gtsam import * -import gtsam_unstable +try: + import gtsam_unstable -def deprecated_wrapper(item, name): - def wrapper(*args, **kwargs): - from warnings import warn - warn('importing the unstable item "{}" from gtsam is deprecated. Please import it from gtsam_unstable.'.format(name)) - return item(*args, **kwargs) - return wrapper + def _deprecated_wrapper(item, name): + def wrapper(*args, **kwargs): + from warnings import warn + message = ('importing the unstable item "{}" directly from gtsam is deprecated. '.format(name) + + 'Please import it from gtsam_unstable.') + warn(message, category=DeprecationWarning) + return item(*args, **kwargs) + return wrapper -for name in dir(gtsam_unstable): - if not name.startswith('__'): - item = getattr(gtsam_unstable, name) - if callable(item): - item = deprecated_wrapper(item, name) - globals()[name] = item + + for name in dir(gtsam_unstable): + if not name.startswith('__'): + item = getattr(gtsam_unstable, name) + if callable(item): + item = _deprecated_wrapper(item, name) + globals()[name] = item + +except ImportError: + pass From 9b80f4b15865346d57a82bef44ccd59e191aaca9 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Thu, 7 Mar 2019 10:11:01 +0000 Subject: [PATCH 15/20] not using DeprecationWarning because it is ignored by default --- cython/gtsam/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/gtsam/__init__.py b/cython/gtsam/__init__.py index f27c6fa44..d40ee4502 100644 --- a/cython/gtsam/__init__.py +++ b/cython/gtsam/__init__.py @@ -9,7 +9,7 @@ try: from warnings import warn message = ('importing the unstable item "{}" directly from gtsam is deprecated. '.format(name) + 'Please import it from gtsam_unstable.') - warn(message, category=DeprecationWarning) + warn(message) return item(*args, **kwargs) return wrapper From 91fa7adf0753de4f8ff92a13c39e83bcfc2978eb Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Mon, 11 Mar 2019 14:54:12 +0000 Subject: [PATCH 16/20] added more keywords --- cython/setup.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index e631d89c0..a4c96f1b8 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -13,7 +13,7 @@ setup( url='https://bitbucket.org/gtborg/gtsam', version='${GTSAM_VERSION_STRING}', # https://www.python.org/dev/peps/pep-0440/ license='Simplified BSD license', - keywords='slam sam', + keywords='slam sam robotics localization mapping optimization', long_description='''${README_CONTENTS}''', # https://pypi.org/pypi?%3Aaction=list_classifiers classifiers=[ From 03500b004bc5e16e48725a3d3500b0f25bab43dd Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Mon, 11 Mar 2019 15:02:11 +0000 Subject: [PATCH 17/20] enforcing the setup script from being run from the installation directory --- cython/setup.py.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cython/setup.py.in b/cython/setup.py.in index a4c96f1b8..0c37cd660 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -1,10 +1,19 @@ import os +import sys try: from setuptools import setup, find_packages 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: "{script_path}"') + print('please run `make install` and run the script from there') + sys.exit(1) + + packages = find_packages() setup( From 5a0e7bb92a38cc3d2e6fe91584ac590dab5fb98c Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Mon, 11 Mar 2019 15:05:53 +0000 Subject: [PATCH 18/20] fixed string formatting to work with python 2 and 3 --- cython/setup.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index 0c37cd660..b7b0b7bc5 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -9,7 +9,7 @@ except ImportError: 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: "{script_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) From ecb8471e860850f8c8f8a665519d3ea6bd6fa16a Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Tue, 12 Mar 2019 09:47:25 +0000 Subject: [PATCH 19/20] updated cython README --- cython/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cython/README.md b/cython/README.md index 78fc7e594..4e76225c7 100644 --- a/cython/README.md +++ b/cython/README.md @@ -21,8 +21,9 @@ by default: `/cython` ```bash export PYTHONPATH=$PYTHONPATH: ``` -- To install system-wide: navigate to `GTSAM_CYTHON_INSTALL_PATH` and run `python setup.py install` +- 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 install gtsam to a subdirectory of the build directory. UNIT TESTS ========== From a4b713454a9f955cafd44bace050957734c4f484 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Tue, 12 Mar 2019 09:49:03 +0000 Subject: [PATCH 20/20] updated cython README --- cython/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cython/README.md b/cython/README.md index 4e76225c7..a524ac04c 100644 --- a/cython/README.md +++ b/cython/README.md @@ -23,7 +23,7 @@ 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 install gtsam to a subdirectory of the build directory. + - 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. UNIT TESTS ==========