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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ c_default := $(shell tput sgr0; tput setaf 7)

define pyesorex
@echo -e '$(c_action)[pyesorex] Running recipe $(c_special)$1$(c_action) on $(c_filename)$(2)$(c_filename).sof$(c_default)'
pyesorex --recipe-dir prototypes/recipes/ $(1) prototypes/sof/$(2).sof --log-level DEBUG
pyesorex --recipe-dir metisp/pyrecipes/ $(1) prototypes/sof/$(2).sof --log-level DEBUG
endef

dark:
Expand Down
133 changes: 133 additions & 0 deletions metisp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# This file is part of the ESO METIS Pipeline
# Copyright (C) 2023-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/>.

cmake_minimum_required(VERSION 3.12)

project(METIS VERSION 0.0.1 LANGUAGES C CXX)

# Add local cmake module search path
list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake")

# Set policies
cmake_policy(VERSION 3.12)
# Safer library linking
cmake_policy(SET CMP0003 NEW)
# Automatically escape preprocessor definitions
cmake_policy(SET CMP0005 NEW)
# Make syntax problems errors
cmake_policy(SET CMP0010 NEW)
# Input directories must have CMakeLists.txt
cmake_policy(SET CMP0014 NEW)
# Do not interpret quoted or bracketed variables in if statments
cmake_policy(SET CMP0054 NEW)
# Usage of <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
# Escape RPATH entries in intermediate scripts
cmake_policy(SET CMP0095 NEW)
# Deprecated FindPythonInterp and FindPythonLibs
cmake_policy(SET CMP0148 NEW)
# exec_program() command should not be called.
cmake_policy(SET CMP0153 NEW)

# Setup basic pipeline package information
include(EsoPipelinePackage)

# Immediately before every release do:
#-------------------------------------
# if (the interface is totally unchanged from previous release)
# REVISION++;
# else {
# /* interfaces have been added, removed or changed */
# REVISION = 0;
# CURRENT++;
# if (any interfaces have been _added_ since last release)
# AGE++;
# if (any interfaces have been _removed_ or incompatibly changed)
# AGE = 0;
# }
eso_set_library_version(0 0 0)

# Require out-of-source build
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
if (NOT DEFINED WITH_IN_SOURCE_BUILD)
message(FATAL_ERROR "CMake generation for this project is not allowed
within the source directory!")
endif()
endif()

# Default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build,
options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()

set(CMAKE_VERBOSE_MAKEFILE ON)

# Set install directories
if (UNIX AND NOT WIN32)
include(GNUInstallDirs)
set(PACKAGE_RECIPE_DIR "${CMAKE_INSTALL_LIBDIR}/esopipes-plugins")
endif()


# Find external packages
find_package(PkgConfig)
find_package(CPL "7.2" REQUIRED COMPONENTS cplcore cplui cpldfs cpldrs)
#find_package(HDRL "1.5" REQUIRED COMPONENTS hdrl)
find_package(Python3 REQUIRED COMPONENTS Interpreter)

# Package creation
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
.git
.svn
.vscode
.clang-format
README.DEV
${PROJECT_BINARY_DIR})
include(CPack)

# Create config.h
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/config.h.cmake"
"${PROJECT_BINARY_DIR}/config.h")
add_definitions(-DHAVE_CONFIG_H)

set_source_files_properties(${PROJECT_BINARY_DIR}/config.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)

# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake"
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

# Add subdirectories
add_subdirectory(metis)
add_subdirectory(recipes)
add_subdirectory(pymetis)
add_subdirectory(pyrecipes)
8 changes: 5 additions & 3 deletions metisp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = *~


SUBDIRS = irplib hdrl metis recipes reflex regtests
DIST_SUBDIRS = irplib hdrl metis recipes reflex regtests
SUBDIRS = irplib hdrl metis recipes pymetis pyrecipes reflex regtests
DIST_SUBDIRS = irplib hdrl metis recipes pymetis pyrecipes reflex regtests

DOXYGEN_SUBDIRS =
PYTHON_SUBDIRS = pymetis

EXTRA_DIST = BUGS Doxyfile.in admin/doxygen.am
EXTRA_DIST = BUGS Doxyfile.in admin/doxygen.am admin/python.am


pipedocs_DATA = ChangeLog AUTHORS NEWS README TODO COPYING
Expand Down Expand Up @@ -70,3 +71,4 @@ libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck

include $(top_srcdir)/admin/doxygen.am
include $(top_srcdir)/admin/python.am
78 changes: 78 additions & 0 deletions metisp/admin/python.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
PYTHON_INTERPRETER = python3

PYMODULE_NAME = py$(PACKAGE)
PYMODULE = $(PYMODULE_NAME)-$(PACKAGE_VERSION)
PYMODULE_CLEAN_FILES = build $(PYMODULE_NAME).egg-info

pip_args = --force --upgrade --no-deps

python: python-recursive

python-am:
@if test -f $(srcdir)/pyproject.toml; then \
echo "$(PYTHON_INTERPRETER) -m build --wheel --outdir=$(builddir)/dist $(srcdir)"; \
d=`pwd`; cd $(srcdir); \
$(PYTHON_INTERPRETER) -m pip wheel --isolated --no-deps --wheel-dir=$(abs_builddir)/dist .; \
test -n "$(PYMODULE_CLEAN_FILES)" && rm -rf $(PYMODULE_CLEAN_FILES); cd $$d; \
else \
echo "Nothing to be done for \`$@'."; \
fi

clean-python: clean-python-recursive

clean-python-am:
@if test -f $(srcdir)/pyproject.toml; then \
echo "Making clean in `basename $(abs_builddir)`"; \
echo "rm -rf $(srcdir)/build"; \
rm -rf $(srcdir)/build; \
echo "rm -rf $(srcdir)/$(PYMODULE_NAME).egg-info"; \
rm -rf $(srcdir)/$(PYMODULE_NAME).egg-info; \
rm -rf $(builddir)/dist \
else \
echo "Nothing to be done for \`$@'."; \
fi

install-python: install-python-recursive
install-python-am: python-am install-python-wheel-am

install-python-wheel-am: python-am
@$(NORMAL_INSTALL)
@if test -f $(srcdir)/pyproject.toml; then \
if test -z "$$VIRTUAL_ENV" && test -z "$$CONDA_PREFIX"; then \
if test $$EUID -ne 0; then \
pip_args="--user $(pip_args)"; \
fi; \
fi; \
list="`ls -1 $(builddir)/dist/$(PYMODULE)*.whl`"; \
for p in $$list; do \
echo " $(PYTHON_INTERPRETER) -m pip install --force --upgrade --no-deps $$p"; \
$(PYTHON_INTERPRETER) -m pip install $(pip_args) $$p; \
done; \
fi

uninstall-python: uninstall-python-recursive
uninstall-python-am:
@$(NORMAL_UNINSTALL)
@if test -f $(srcdir)/pyproject.toml; then \
$(PYTHON_INTERPRETER) -m pip uninstall --yes $(PYMODULE_NAME); \
fi

python-recursive clean-python-recursive install-python-recursive uninstall-python-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(PYTHON_SUBDIRS)'; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
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})
Loading