Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move python files to proper directories #47

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8637aff
Move edps workflows to proper directory
hugobuddel Oct 13, 2024
8415f98
Move recipes to proper pyrecipes folder
hugobuddel Oct 13, 2024
66595b4
Move python files to pymetis
hugobuddel Oct 13, 2024
9e606e9
Add python support to configure.ac
hugobuddel Oct 13, 2024
1619bbf
Add CMakeLists based on iiinstrument-dev-pymodules branch
hugobuddel Oct 13, 2024
3dc89c7
Add cmake directory based on iiinstrument-dev-pymodules
hugobuddel Oct 13, 2024
937ca12
Move python code to src directory
hugobuddel Oct 13, 2024
ef37dad
Add pymetis setup files based on iiinstrument-dev-pymodules
hugobuddel Oct 13, 2024
3884f63
Add python.am copied from iiinstrument-dev-pymodules
hugobuddel Oct 13, 2024
d4bddcc
Add pyrecipes CMakeLists.txt and Makefile.am
hugobuddel Oct 13, 2024
318d06e
Update Makefile.am based on iiinstrument-dev-pythonmodules
hugobuddel Oct 13, 2024
3c1f25a
Add CMakeLists.txt for C-metis and C-recipes
hugobuddel Oct 13, 2024
99cd6bd
Add setup.cfg
hugobuddel Oct 13, 2024
e12342a
Oops, forgot some iiinstruments
hugobuddel Oct 13, 2024
face45b
Another IIINSTRUMENTS
hugobuddel Oct 13, 2024
f48374f
Another iiinstrument
hugobuddel Oct 13, 2024
96de044
Two more IIINSTRUMENTS
hugobuddel Oct 13, 2024
f5a2874
Another IIINSTRUMENT
hugobuddel Oct 13, 2024
555381e
Properly name the module pymetis instead of pyiiinstrument
hugobuddel Oct 13, 2024
36a6034
Move pymetis files again into pymetis/src/pymetis
hugobuddel Oct 13, 2024
f5254ee
Rename prototypes -> pymetis
hugobuddel Oct 13, 2024
91117d0
Include pymetis.mixins package
hugobuddel Oct 13, 2024
e8d8dfc
setup.cfg is generated automatically
hugobuddel Oct 13, 2024
37dca32
Use metis_ifu_distortion name
hugobuddel Oct 13, 2024
be59545
'fix' Makefile
hugobuddel Oct 13, 2024
117b121
Rename prototypes -> pymetis
hugobuddel Oct 13, 2024
d590e7f
Move recipes to pymetis package
hugobuddel Oct 15, 2024
4552f1e
Add metis_recipes.py that imports everything
hugobuddel Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add cmake directory based on iiinstrument-dev-pymodules
hugobuddel committed Oct 13, 2024
commit 3dc89c7ec1baee76dcc56aa0a63a2c2c6532682a
28 changes: 28 additions & 0 deletions metisp/cmake/EsoPipelinePackage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
macro(eso_set_library_version current revision age)
set(PACKAGE_LT_CURRENT ${current})
set(PACKAGE_LT_REVISION ${revision})
set(PACKAGE_LT_AGE ${age})
set(PACKAGE_LIBRARY_VERSION ${current}.${revision}.${age})
endmacro()

# Package name and version
string(TOLOWER ${PROJECT_NAME} PACKAGE)

set(PACKAGE_MAJOR ${PROJECT_VERSION_MAJOR})
set(PACKAGE_MINOR ${PROJECT_VERSION_MINOR})
set(PACKAGE_PATCH ${PROJECT_VERSION_PATCH})

set(PACKAGE_NAME "${PACKAGE}")
set(PACKAGE_AUTHOR "European Southern Observatory")
set(PACKAGE_BUGREPORT "https://support.eso.org")

set(PACKAGE_VERSION "${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_PATCH}")

math(EXPR PACKAGE_BINARY_AGE "100 * ${PACKAGE_MINOR} + ${PACKAGE_PATCH}")
math(EXPR PACKAGE_BINARY_VERSION "10000 * ${PACKAGE_MAJOR} + ${PACKAGE_BINARY_AGE}")

# Library ABI version, using GNU libtool terminology
set(PACKAGE_LT_CURRENT ${PROJECT_VERSION_MAJOR})
set(PACKAGE_LT_REVISION ${PROJECT_VERSION_MINOR})
set(PACKAGE_LT_AGE ${PROJECT_VERSION_PATCH})
set(PACKAGE_LIBRARY_VERSION ${current}.${revision}.${age})
282 changes: 282 additions & 0 deletions metisp/cmake/FindCPL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
# This file is part of the ESO Common Pipeline Library
# Copyright (C) 2001-2022 European Southern Observatory
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#[=======================================================================[.rst:
FindCPL
-------
Find the Common Pipeline Library headers and libraries. The module can be
configured using the following variables:
CPL_ROOT: Location where CPL is installed
or the corresponding environment variable CPL_ROOT.
The module also takes into account the environment variable CPLDIR.
If it is set it should point to the location of the CPL installation.
Using the environment variable is equivalent to setting the option
CPL_ROOT. However, if both, CPL_ROOT and CPLDIR, are set the CPL_ROOT
variable setting takes precedence.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``CPL::cplcore``
The cplcore library component.
``CPL::cplui``
The cplui library component.
``CPL::cpldfs``
The cpldfs library component.
``CPL::cpldrs``
The cpldrs library component.
``CPL::cplgasgano``
The cplgasgano library component.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``CPL_FOUND``
"True" if both, CPL header files and the CPL libraries were found.
``CPL_INCLUDE_DIR``
Path where the CPL header files are located.
``CPL_CPLCORE_LIBRARY``
Path where the cplcore library is located.
``CPL_CPLUI_LIBRARY``
Path where the cplui library is located.
``CPL_CPLDFS_LIBRARY``
Path where the cpldfs library is located.
``CPL_CPLDRS_LIBRARY``
Path where the cpldrs library is located.
``CPL_CPLGASGANO_LIBRARY``
Path where the cplgasgano library is located.
``CPL_VERSION``
Full version string of the CPL libraries.
``CPL_VERSION_MAJOR``
Major version number of the CPL libraries.
``CPL_VERSION_MINOR``
Minor version number of the CPL libraries.
``CPL_VERSION_PATCH``
Patch version number of the CPL libraries.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``CPL_INCLUDE_DIR``
Path where the CPL header files are located.
``CPL_CPLCORE_LIBRARY``
Path where the cplcore library is located.
``CPL_CPLUI_LIBRARY``
Path where the cplui library is located.
``CPL_CPLDFS_LIBRARY``
Path where the cpldfs library is located.
``CPL_CPLDRS_LIBRARY``
Path where the cpldrs library is located.
``CPL_CPLGASGANO_LIBRARY``
Path where the cplgasgano library is located.
#]=======================================================================]

cmake_policy(VERSION 3.12)

include(FindPackageHandleStandardArgs)

if(NOT PKG_CONFIG_FOUND)
find_package(PkgConfig QUIET)
endif()

# For backwards compatibility also honor the CPLDIR environment variable.
if(NOT CPL_ROOT AND (NOT "$ENV{CPLDIR}" STREQUAL ""))
set(CPL_ROOT "$ENV{CPLDIR}")
endif()

if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_CPL QUIET IMPORTED_TARGET GLOBAL
cplcore
cplui
cpldfs
cpldrs
cplgasgano)
if(PC_CPL_FOUND)
set(CPL_VERSION ${PC_CPL_VERSION})
endif()
endif()

# Search for the header files
find_path(CPL_INCLUDE_DIR
NAMES cpl.h
PATH_SUFFIXES cpl
HINTS ${CPL_ROOT}/include ${PC_CPL_INCLUDE_DIRS})
mark_as_advanced(CPL_INCLUDE_DIR)

# Search for the component libraries. Also look into the 'lib64'
# directoy when searching for the libraries.
set(FIND_LIBRARY_USE_LIB64_PATHS True)
find_library(CPL_CPLCORE_LIBRARY
NAMES cplcore
HINTS ${CPL_ROOT}/lib ${PC_CPL_LIBRARY_DIRS})
mark_as_advanced(CPL_CPLCORE_LIBRARY)
if(CPL_CPLCORE_LIBRARY)
set(CPL_cplcore_FOUND True)
endif()

find_library(CPL_CPLUI_LIBRARY
NAMES cplui
HINTS ${CPL_ROOT}/lib ${PC_CPL_LIBRARY_DIRS})
mark_as_advanced(CPL_CPLUI_LIBRARY)
if(CPL_CPLUI_LIBRARY)
set(CPL_cplui_FOUND True)
endif()

find_library(CPL_CPLDFS_LIBRARY
NAMES cpldfs
HINTS ${CPL_ROOT}/lib ${PC_CPL_LIBRARY_DIRS})
mark_as_advanced(CPL_CPLDFS_LIBRARY)
if(CPL_CPLDFS_LIBRARY)
set(CPL_cpldfs_FOUND True)
endif()

find_library(CPL_CPLDRS_LIBRARY
NAMES cpldrs
HINTS ${CPL_ROOT}/lib ${PC_CPL_LIBRARY_DIRS})
mark_as_advanced(CPL_CPLDRS_LIBRARY)
if(CPL_CPLDRS_LIBRARY)
set(CPL_cpldrs_FOUND True)
endif()

find_library(CPL_CPLGASGANO_LIBRARY
NAMES cplgasgano
HINTS ${CPL_ROOT}/lib ${PC_CPL_LIBRARY_DIRS})
mark_as_advanced(CPL_CPLGASGANO_LIBRARY)
if(CPL_CPLGASGANO_LIBRARY)
set(CPL_cplgasgano_FOUND True)
endif()

# Determine the library version from the header files if
# it is not yet known. Potentially this has already been
# set by "pkg-config".
if(CPL_INCLUDE_DIR AND NOT CPL_VERSION)
if(EXISTS ${CPL_INCLUDE_DIR}/cpl_version.h)
file(STRINGS "${CPL_INCLUDE_DIR}/cpl_version.h"
cpl_version
REGEX "^[\t ]*#define[\t ]+CPL_VERSION_STRING[\t ]+\"[0-9]+\.[0-9]+.*\"")
string(REGEX REPLACE
"^[\t ]*#define[\t ]+CPL_VERSION_STRING[\t ]+\"([0-9]+\.[0-9][^a-z \"]*).*" "\\1"
CPL_VERSION ${cpl_version})
unset(cpl_version)
endif()
endif()

# Decompose the version string into major, minor and patch version numbers
set(cpl_version_regex "([0-9]+)\.([0-9]+)(\.([0-9]+))?.*")
string(REGEX MATCH ${cpl_version_regex}
cpl_version_string "${CPL_VERSION}")
set(CPL_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPL_VERSION_MINOR ${CMAKE_MATCH_2})
if(NOT "${CMAKE_MATCH_4}" STREQUAL "")
set(CPL_VERSION_PATCH ${CMAKE_MATCH_4})
endif()
unset(cpl_version_string)
unset(cpl_version_regex)

find_package_handle_standard_args(CPL
REQUIRED_VARS CPL_INCLUDE_DIR
VERSION_VAR CPL_VERSION
HANDLE_COMPONENTS)

if(CPL_FOUND)
if(NOT TARGET CPL::cplcore)
add_library(CPL::cplcore UNKNOWN IMPORTED)
set_target_properties(CPL::cplcore PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CPL_INCLUDE_DIR}")
if(EXISTS "${CPL_CPLCORE_LIBRARY}")
set_target_properties(CPL::cplcore PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${CPL_CPLCORE_LIBRARY})
endif()
endif()

if(NOT TARGET CPL::cplui)
add_library(CPL::cplui UNKNOWN IMPORTED)
set_target_properties(CPL::cplui PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CPL_INCLUDE_DIR}")
if(EXISTS "${CPL_CPLUI_LIBRARY}")
set_target_properties(CPL::cplui PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${CPL_CPLUI_LIBRARY})
target_link_libraries(CPL::cplui INTERFACE CPL::cplcore)
endif()
endif()

if(NOT TARGET CPL::cpldfs)
add_library(CPL::cpldfs UNKNOWN IMPORTED)
set_target_properties(CPL::cpldfs PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CPL_INCLUDE_DIR}")
if(EXISTS "${CPL_CPLDFS_LIBRARY}")
set_target_properties(CPL::cpldfs PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${CPL_CPLDFS_LIBRARY})
target_link_libraries(CPL::cpldfs INTERFACE CPL::cplcore)
endif()
endif()

if(NOT TARGET CPL::cpldrs)
add_library(CPL::cpldrs UNKNOWN IMPORTED)
set_target_properties(CPL::cpldrs PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CPL_INCLUDE_DIR}")
if(EXISTS "${CPL_CPLDRS_LIBRARY}")
set_target_properties(CPL::cpldrs PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${CPL_CPLDRS_LIBRARY})
target_link_libraries(CPL::cpldrs INTERFACE CPL::cplcore)
endif()
endif()

if(NOT TARGET CPL::cplgasgano)
add_library(CPL::cplgasgano UNKNOWN IMPORTED)
set_target_properties(CPL::cplgasgano PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CPL_INCLUDE_DIR}")
if(EXISTS "${CPL_CPLGASGANO_LIBRARY}")
set_target_properties(CPL::cplgasgano PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${CPL_CPLGASGANO_LIBRARY})
target_link_libraries(CPL::cplgasgano INTERFACE CPL::cpldfs CPL::cplcore)
endif()
endif()
endif()
162 changes: 162 additions & 0 deletions metisp/cmake/FindHDRL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# This file is part of the ESO High Level Data Reduction Library
# Copyright (C) 2003-2024 European Southern Observatory
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#[=======================================================================[.rst:
FindHDRL
-------
Find the High Level Data Reduction Library headers and library. The
module can be configured using the following variables:
HDRL_ROOT: Location where HDRL is installed
or the corresponding environment variable HDRL_ROOT.
The module also takes into account the environment variable HDRLDIR.
If it is set it should point to the location of the HDRL installation.
Using the environment variable is equivalent to setting the option
HDRL_ROOT. However, if both, HDRL_ROOT and HDRLDIR, are set the
HDRL_ROOT variable setting takes precedence.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``HDRL::hdrl``
The HDRL library.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``HDRL_FOUND``
"True" if both, HDRL header files and the HDRL library were found.
``HDRL_INCLUDE_DIR``
Path where the HDRL header files are located.
``HDRL_LIBRARY``
Path where the HDRL library is located.
``HDRL_VERSION``
Full version string of the HDRL library.
``HDRL_VERSION_MAJOR``
Major version number of the HDRL library.
``HDRL_VERSION_MINOR``
Minor version number of the HDRL library.
``HDRL_VERSION_PATCH``
Patch version number of the HDRL library.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``HDRL_INCLUDE_DIR``
Path where the HDRL header files are located.
``HDRL_LIBRARY``
Path where the HDRL library is located.
#]=======================================================================]

cmake_policy(VERSION 3.12)

include(FindPackageHandleStandardArgs)

if(NOT PKG_CONFIG_FOUND)
find_package(PkgConfig QUIET)
endif()

# For backwards compatibility also honor the HDRLDIR environment variable.
if(NOT HDRL_ROOT AND (NOT "$ENV{HDRLDIR}" STREQUAL ""))
set(HDRL_ROOT "$ENV{HDRLDIR}")
endif()

if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_HDRL QUIET IMPORTED_TARGET GLOBAL
hdrl)
if(PC_HDRL_FOUND)
set(HDRL_VERSION ${PC_HDRL_VERSION})
endif()
endif()

# Search for the header files
find_path(HDRL_INCLUDE_DIR
NAMES hdrl.h
PATH_SUFFIXES hdrl
HINTS ${HDRL_ROOT}/include ${PC_HDRL_INCLUDE_DIRS})
mark_as_advanced(HDRL_INCLUDE_DIR)

# Search for the component libraries. Also look into the 'lib64'
# directoy when searching for the libraries.
set(FIND_LIBRARY_USE_LIB64_PATHS True)
find_library(HDRL_LIBRARY
NAMES hdrl
HINTS ${HDRL_ROOT}/lib ${PC_HDRL_LIBRARY_DIRS})
mark_as_advanced(HDRL_LIBRARY)
if(HDRL_LIBRARY)
set(HDRL_hdrl_FOUND True)
endif()

# Determine the library version from the header files if
# it is not yet known. Potentially this has already been
# set by "pkg-config".
if(HDRL_INCLUDE_DIR AND NOT HDRL_VERSION)
if(EXISTS ${HDRL_INCLUDE_DIR}/hdrl_version.h)
file(STRINGS "${HDRL_INCLUDE_DIR}/hdrl_version.h"
hdrl_version
REGEX "^[\t ]*#define[\t ]+HDRL_VERSION_STRING[\t ]+\"[0-9]+\.[0-9]+.*\"")
string(REGEX REPLACE
"^[\t ]*#define[\t ]+HDRL_VERSION_STRING[\t ]+\"([0-9]+\.[0-9][^a-z \"]*).*" "\\1"
HDRL_VERSION ${hdrl_version})
unset(hdrl_version)
endif()
endif()

# Decompose the version string into major, minor and patch version numbers
set(hdrl_version_regex "([0-9]+)\.([0-9]+)(\.([0-9]+))?.*")
string(REGEX MATCH ${hdrl_version_regex}
hdrl_version_string "${HDRL_VERSION}")
set(HDRL_VERSION_MAJOR ${CMAKE_MATCH_1})
set(HDRL_VERSION_MINOR ${CMAKE_MATCH_2})
if(NOT "${CMAKE_MATCH_4}" STREQUAL "")
set(HDRL_VERSION_PATCH ${CMAKE_MATCH_4})
endif()
unset(hdrl_version_string)
unset(hdrl_version_regex)

find_package_handle_standard_args(HDRL
REQUIRED_VARS HDRL_INCLUDE_DIR
VERSION_VAR HDRL_VERSION
HANDLE_COMPONENTS)

if(HDRL_FOUND)
if(NOT TARGET HDRL::hdrl)
add_library(HDRL::hdrl UNKNOWN IMPORTED)
set_target_properties(HDRL::hdrl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${HDRL_INCLUDE_DIR}")
if(EXISTS "${HDRL_LIBRARY}")
set_target_properties(HDRL::hdrl PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${HDRL_LIBRARY})
endif()
endif()
endif()
24 changes: 24 additions & 0 deletions metisp/cmake/cmake_uninstall.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0153 NEW)

if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt")
endif()

file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE output
RESULT_VARIABLE result)
if(NOT "${result}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()
cmake_policy(POP)
6 changes: 6 additions & 0 deletions metisp/cmake/config.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define PACKAGE "@PACKAGE@"
#define PACKAGE_NAME "@PACKAGE_NAME@"
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"

#define METIS_BINARY_VERSION @PACKAGE_BINARY_VERSION@