diff --git a/CMakeLists.txt b/CMakeLists.txt index d1089cf46..9a1cd94fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -513,11 +513,12 @@ write_basic_package_version_file( if(${BUILD_PYTHON}) find_package(Python3 COMPONENTS Development Interpreter REQUIRED) file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py) - file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/) - set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.py.in") + file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/src) + file(COPY python/README.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python) + set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.py.in") set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py") - set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.cfg.in") - set(SETUP_CFG "${CMAKE_CURRENT_BINARY_DIR}/setup.cfg") + set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.cfg.in") + set(SETUP_CFG "${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg") configure_file(${SETUP_PY_IN} ${SETUP_PY}) configure_file(${SETUP_CFG_IN} ${SETUP_CFG}) add_custom_command( @@ -526,7 +527,6 @@ if(${BUILD_PYTHON}) COMMAND "${Python3_EXECUTABLE}" ${SETUP_PY} build_ext -L ${CMAKE_CURRENT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/python -t${CMAKE_CURRENT_BINARY_DIR}/python && "${Python3_EXECUTABLE}" ${SETUP_PY} build_py && - "${Python3_EXECUTABLE}" ${SETUP_PY} egg_info -b ${CMAKE_CURRENT_BINARY_DIR}/python && "${Python3_EXECUTABLE}" ${SETUP_PY} sdist DEPENDS ${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses diff --git a/python/setup.py.in b/python/setup.py.in deleted file mode 100644 index 7482e295a..000000000 --- a/python/setup.py.in +++ /dev/null @@ -1,15 +0,0 @@ -from setuptools import setup, find_packages -import os - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -if __name__ == '__main__': - setup(name='notcurses', - version='${PROJECT_VERSION}', - package_dir={ '': '${CMAKE_CURRENT_BINARY_DIR}/python/notcurses' }, - packages=find_packages('${CMAKE_CURRENT_BINARY_DIR}/python/notcurses'), - cffi_modules=['${CMAKE_CURRENT_BINARY_DIR}/python/notcurses/build_notcurses.py:ffibuild'], - py_modules=["notcurses"], - include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/include'] -) diff --git a/python/setup.cfg.in b/tools/setup.cfg.in similarity index 100% rename from python/setup.cfg.in rename to tools/setup.cfg.in diff --git a/tools/setup.py.in b/tools/setup.py.in new file mode 100644 index 000000000..3a2d52092 --- /dev/null +++ b/tools/setup.py.in @@ -0,0 +1,35 @@ +from setuptools import setup, find_packages +import os + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +if __name__ == '__main__': + setup(name='notcurses', + version='${PROJECT_VERSION}', + package_dir={ '': '${CMAKE_CURRENT_BINARY_DIR}/python/src/notcurses' }, + packages=find_packages('${CMAKE_CURRENT_BINARY_DIR}/python/src/notcurses'), + cffi_modules=['${CMAKE_CURRENT_BINARY_DIR}/python/src/notcurses/build_notcurses.py:ffibuild'], + py_modules=["notcurses"], + include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/include'], + long_description=read('${CMAKE_CURRENT_SOURCE_DIR}/README.md'), + zip_safe=True, + platforms=["any"], + long_description_content_type="text/markdown", + install_requires=["cffi>=1.0.0"], + setup_requires=["cffi>=1.0.0"], + # see https://pypi.org/pypi?%3Aaction=list_classifiers + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Programming Language :: Python', + ], + author="Nick Black", + author_email="nickblack@linux.com", + description="Blingful TUI construction library (python bindings)", + keywords="ncurses curses tui console graphics", + license='Apache License, Version 2.0', + url='https://github.com/dankamongmen/notcurses' +)