Commit b50083bf authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by Peterson, Peter
Browse files

Replace setup.py.in templates with plain setup.py files

This greatly simplifies the understanding of the files
themselves as they then simply match more standard Python
projects. The driving CMake code then simply makes use
of them as a user would.
parent 9f7e22ec
......@@ -102,8 +102,6 @@ build/
Framework/Kernel/inc/MantidKernel/GitHubApiHelper.h
qt/python/mantidqt/resources.py
qt/applications/workbench/workbench/app/resources.py
qt/applications/workbench/setup.py
qt/python/setup.py
# Visual C++ cache files
ipch/
......
setup.py
mantid/pyversion.py
mantid/buildconfig.py
mantid/kernel/mpisetup.py
mantid/kernel/packagesetup.py
\ No newline at end of file
mantid/kernel/packagesetup.py
......@@ -9,6 +9,7 @@
import os
from setuptools import find_packages, setup
# The most basic setup possible to be able to use pip develop/install
setup(
name='mantid',
......
......@@ -18,12 +18,10 @@
# file in the egg link directory
# ~~~
function(add_python_package pkg_name)
# Create a setup.py file if necessary
set(_setup_py ${CMAKE_CURRENT_SOURCE_DIR}/setup.py)
set(_setup_py_build_root ${CMAKE_CURRENT_BINARY_DIR})
set(_setup_py_build_root ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(_egg_link_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR})
_configure_setup_py(${_setup_py} ${_setup_py_build_root})
cmake_parse_arguments(
_parsed_arg "EXECUTABLE;GENERATE_SITECUSTOMIZE"
"EGGLINKNAME;EXCLUDE_FROM_INSTALL;INSTALL_BIN_DIR" "INSTALL_LIB_DIRS"
......@@ -125,40 +123,3 @@ function(add_python_package pkg_name)
)
endif()
endfunction()
# ~~~
# Function to generate a setup.py from a template. It is assumed the template
# resides at ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in.
# The generated file injects custom build commands to:
# - ensure setup build/install ends up in the binary tree and not source
# - inject a sitecustomize file in the egg-link directory if one does not
# exist
# ~~~
function(_configure_setup_py target build_root)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
message(
FATAL_ERROR
"Unable to generate setup.py. ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in not found."
)
endif()
# # ~~~ set(SETUPTOOLS_BUILD_COMMANDS_DEF "class
# CustomBuildDir(setuptools_command_cls): user_options =
# setuptools_command_cls.user_options[:] boolean_options =
# setuptools_command_cls.boolean_options[:]
# def finalize_options(self): self.build_lib = '${build_root}/build'
# setuptools_command_cls.finalize_options(self)
# def patch_setuptools_command(cmd_cls_name, CommandCls): import importlib
# cmd_module = importlib.import_module('setuptools.command.' + cmd_cls_name)
# setuptools_command_cls = getattr(cmd_module, cmd_cls_name) return CommandCls
# CustomBuildPy = patch_setuptools_command('build_py') CustomInstall =
# patch_setuptools_command('install') CustomInstallLib =
# patch_setuptools_command('install_lib') " ) # ~~~
# set(SETUPTOOLS_BUILD_COMMANDS_USE "cmdclass={'build_py': CustomBuildPy,
# 'install': CustomInstall, 'install-lib': CustomInstallLib }" )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${target} @ONLY)
endfunction()
......@@ -5,15 +5,14 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import os
from setuptools import find_packages, setup
@SETUPTOOLS_BUILD_COMMANDS_DEF@
# The most basic setup possible to be able to use setup.py develop/install
setup(
name='MantidWorkbench', # probably the wrong name if someone wants to include it
version='@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@@VERSION_TWEAK_PY@',
version=os.environ['MANTID_VERSION_STR'],
install_requires=['mantidqt'],
packages=find_packages(exclude=['*.test']),
package_data={'': ['*.ui']},
......@@ -22,5 +21,4 @@ setup(
'workbench = workbench.app.main:main'
]
},
@SETUPTOOLS_BUILD_COMMANDS_USE@
)
......@@ -5,16 +5,13 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import os
from setuptools import find_packages, setup
@SETUPTOOLS_BUILD_COMMANDS_DEF@
setup(
name='mantidqt', # must match what is required by workbench setup.py
name='mantidqt', # must match what is required by workbench setup.py
install_requires=['mantid'],
version='@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@@VERSION_TWEAK_PY@',
version=os.environ['MANTID_VERSION_STR'],
packages=find_packages(exclude=['*.test']),
package_data={'': ['*.ui']},
@SETUPTOOLS_BUILD_COMMANDS_USE@
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment