diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa6268..33c61d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release notes +## Version 2.2.6 + +### Fixes + +- fix for windows and python>=3.8 +- Fix for matplotlib >=3.7.0 when removing hkl labels + ## Version 2.2.5 ### Changes diff --git a/README.rst b/README.rst index 2a71c1c..dde51f7 100644 --- a/README.rst +++ b/README.rst @@ -17,10 +17,6 @@ INSTALLATION ------------ pyobjcryst is available for Python 3.7 (deprecated), and 3.8 to 3.11. -Note regarding windows: on conda-forge, pyobjcryst 2.2.3 is available -for python3.7 only, and versions >=2.2.4 are available for python 3.8 and -3.9 using a `pypy` environment rather than the regular cpython interpreter. - Using conda (recommended) ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/SConstruct b/SConstruct index ba12b33..db05ae7 100644 --- a/SConstruct +++ b/SConstruct @@ -52,7 +52,7 @@ def pyconfigvar(name): # copy system environment variables related to compilation DefaultEnvironment(ENV=subdictionary(os.environ, ''' - PATH PYTHONPATH GIT_DIR + PATH PYTHONPATH GIT_DIR HOMEPATH HOMEDRIVE CPATH CPLUS_INCLUDE_PATH LIBRARY_PATH LD_RUN_PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH MACOSX_DEPLOYMENT_TARGET LANG diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..35cd3af --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +# pyproject.toml +[build-system] +requires = ["setuptools", "numpy"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyobjcryst" # as it would appear on PyPI +version = "2.2.6" diff --git a/setup.py b/setup.py index 38afdfa..00788de 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ import platform from setuptools import setup from setuptools import Extension -from numpy.distutils.misc_util import get_numpy_include_dirs +import numpy as np # Use this version when git data are not available as in a git zip archive. # Update when tagging a new release. @@ -27,7 +27,7 @@ 'libraries': ['ObjCryst'], 'extra_compile_args': ['-std=c++11', '-DBOOST_ERROR_CODE_HEADER_ONLY'], 'extra_link_args': [], - 'include_dirs': get_numpy_include_dirs(), + 'include_dirs': [np.get_include()], 'library_dirs': [] } if platform.system() == 'Windows': @@ -36,6 +36,7 @@ ext_kws['include_dirs'] += [pjoin(os.environ['CONDA_PREFIX'], 'include'), pjoin(os.environ['CONDA_PREFIX'], 'Library', 'include')] ext_kws['library_dirs'] += [pjoin(os.environ['CONDA_PREFIX'], 'Library', 'lib'), + pjoin(os.environ['CONDA_PREFIX'], 'Library', 'bin'), pjoin(os.environ['CONDA_PREFIX'], 'libs')] ext_kws['libraries'] = ['libObjCryst'] elif platform.system() == 'Darwin': @@ -168,7 +169,7 @@ def getversioncfg(): url="https://github.com/diffpy/pyobjcryst", # Required python packages - install_requires=['numpy'], + install_requires=['numpy', 'packaging'], extras_require={'gui': ['ipywidgets', 'jupyter', 'matplotlib', 'ipympl', 'py3dmol'], 'doc': ['sphinx', 'm2r2', 'sphinx_py3doc_enhanced_theme', 'nbsphinx', 'nbsphinx-link']}, diff --git a/src/extensions/SConscript b/src/extensions/SConscript index 59cbe90..226fb8c 100644 --- a/src/extensions/SConscript +++ b/src/extensions/SConscript @@ -1,11 +1,8 @@ +import numpy as np Import('env', 'pyoutput') # make sure numpy headers are available -npdirs = pyoutput( - 'from numpy.distutils.misc_util import get_numpy_include_dirs\n' - 'print("\\n".join(get_numpy_include_dirs()))') -npdirs = [d.strip() for d in npdirs.split('\n')] -env.AppendUnique(CPPPATH=npdirs) +env.AppendUnique(CPPPATH=[np.get_include()]) # configure the boost_python library, which may have different extensions if not (GetOption('clean') or env.GetOption('help')): diff --git a/src/extensions/SConscript.configure b/src/extensions/SConscript.configure index bd25888..65b2877 100644 --- a/src/extensions/SConscript.configure +++ b/src/extensions/SConscript.configure @@ -1,8 +1,13 @@ import platform +from os.path import join as pjoin Import('env', 'pyconfigvar', 'pyversion') # Helper functions ----------------------------------------------------------- +env.Append(LIBPATH=pjoin(env['prefix'], 'Library', 'bin')) +env.Append(LIBPATH=pjoin(env['prefix'], 'Library', 'lib')) +env.Append(CPPPATH=[pjoin(env['prefix'], 'include')]) +env.Append(CPPPATH=[pjoin(env['prefix'], 'Library', 'include')]) def CheckOptimizerFlag(context, flag): ccflags_save = context.env['CCFLAGS'] diff --git a/src/extensions/registerconverters.cpp b/src/extensions/registerconverters.cpp index 25312ad..e421487 100644 --- a/src/extensions/registerconverters.cpp +++ b/src/extensions/registerconverters.cpp @@ -224,8 +224,7 @@ void _deleteMAV(MolAtomVec& mav, size_t i) /* Exception translation */ -PyObject* pyobjcryst_ObjCrystException = - PyErr_NewException((char*)"pyobjcryst.ObjCrystException", 0, 0); +PyObject* pyobjcryst_ObjCrystException; void translateException(const ObjCrystException& e) @@ -277,6 +276,7 @@ void wrap_registerconverters() { /* Exceptions */ + pyobjcryst_ObjCrystException = PyErr_NewException((char*)"pyobjcryst.ObjCrystException", 0, 0); register_exception_translator(translateException); // We want silent exceptions ObjCrystException::verbose = false;