Skip to content

Commit

Permalink
Merge pull request #665 from kordejong/gh661
Browse files Browse the repository at this point in the history
Keep .py extension on Python command scripts on Windows
  • Loading branch information
kordejong committed Jun 19, 2024
2 parents a317961 + 80af0be commit 288d5a7
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ jobs:
export PYTHONPATH="${{ env.lue_runtime_install_directory }}/lib/python${{ matrix.python_version }}:$PYTHONPATH"
export LD_LIBRARY_PATH="${{ env.hpx_install_directory }}/lib:$LD_LIBRARY_PATH"
${{ env.lue_runtime_install_directory }}/bin/lue_calculate --version
${{ env.lue_runtime_install_directory }}/bin/lue_scalability --version
${{ env.lue_runtime_install_directory }}/bin/lue_calculate.py --version
${{ env.lue_runtime_install_directory }}/bin/lue_scalability.py --version
python3 -c "import lue, lue.data_model, lue.framework, lue.pcraster, lue.qa.scalability; print(lue.__version__)"
- name: consume
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ jobs:
export PYTHONPATH="${{ env.lue_runtime_install_directory }}/lib/python${{ matrix.python_version}}:$PYTHONPATH"
export DYLD_FALLBACK_LIBRARY_PATH="${{ env.hpx_install_directory }}/lib:$DYLD_FALLBACK_LIBRARY_PATH"
python${{ matrix.python_version }} ${{ env.lue_runtime_install_directory }}/bin/lue_calculate --version
python${{ matrix.python_version }} ${{ env.lue_runtime_install_directory }}/bin/lue_scalability --version
python${{ matrix.python_version }} ${{ env.lue_runtime_install_directory }}/bin/lue_calculate.py --version
python${{ matrix.python_version }} ${{ env.lue_runtime_install_directory }}/bin/lue_scalability.py --version
python${{ matrix.python_version }} -c "import lue, lue.data_model, lue.framework, lue.pcraster, lue.qa.scalability; print(lue.__version__)"
- name: consume
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ jobs:
# Only needed on dev machines with custom HPX build, like we have here.
export PATH="`pwd`/${{ env.hpx_install_directory }}/bin:$PATH"
${{ env.lue_runtime_install_directory }}/bin/lue_calculate --version
${{ env.lue_runtime_install_directory }}/bin/lue_scalability --version
${{ env.lue_runtime_install_directory }}/bin/lue_calculate.py --version
${{ env.lue_runtime_install_directory }}/bin/lue_scalability.py --version
python -c "import lue, lue.data_model, lue.framework, lue.pcraster, lue.qa.scalability; print(lue.__version__)"
- name: consume
Expand Down
14 changes: 11 additions & 3 deletions environment/cmake/LueConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,23 @@ endif()

if(LUE_PYBIND11_REQUIRED)
# Order matters: Pybind11 must be searched for after Python has been found.
# find_package(pybind11 2.10 REQUIRED)
# pybind11 ≥ 2.12 is needed for numpy 2.0 support

FetchContent_Declare(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG 8a099e44b3d5f85b20f05828d919d2332a8de841 # 2.11.1
GIT_TAG 3e9dfa2866941655c56877882565e7577de6fc7b # 2.12.0
SYSTEM
FIND_PACKAGE_ARGS
FIND_PACKAGE_ARGS 2.12
)
FetchContent_MakeAvailable(pybind11)

# Disable support for numpy 2.0 for now
# https://github.com/computationalgeography/lue/issues/664
set(PYBIND11_NUMPY_1_ONLY TRUE)

# Silence pybind11 for now
# https://github.com/computationalgeography/lue/issues/484
set(PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF TRUE)
endif()


Expand Down
9 changes: 4 additions & 5 deletions environment/conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ build:

requirements:
build:
- {{ compiler('cxx') }}
- ninja
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- pybind11 # [build_platform != target_platform]
- {{ compiler('cxx') }}
- ninja

host:
- python
Expand Down Expand Up @@ -60,8 +59,8 @@ test:
commands:
- lue_translate -h # [not (osx and arm64)]
- lue_validate -h # [not (osx and arm64)]
- lue_calculate -h # [not (osx and arm64) and not win]
- lue_scalability -h # [not (osx and arm64) and not win]
- lue_calculate.py -h # [not (osx and arm64)]
- lue_scalability.py -h # [not (osx and arm64)]


about:
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/python/test/case_study/constant_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_case_study(self):

constants = planets.add_property_set("constants")

name = constants.add_property("name", dtype=np.unicode_)
name = constants.add_property("name", dtype=np.str_)
name.value.expand(nr_planets)[:] = np.array(["ñeptùne", "mærß", "ùræñùß"])

gravity = constants.add_property("gravity", dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion source/data_model/python/test/core/array_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUp(self):
self.nr_cols = 2
self.value_shape = (self.nr_rows, self.nr_cols)
self.numeric_value_type = np.int32
self.string_value_type = np.unicode_
self.string_value_type = np.str_

self.property_set = self.phenomenon.add_property_set("my_property_set")
numeric_property = self.property_set.add_property(
Expand Down
4 changes: 2 additions & 2 deletions source/framework/python/script/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_calculate
OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_calculate.py
INPUT lue_calculate.py
)


lue_install_programs(TARGETS
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_calculate
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_calculate.py
)
8 changes: 4 additions & 4 deletions source/qa/python/qa/scalability/experiment/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ def write_benchmark_settings(lue_dataset, cluster, benchmark, experiment):

cluster_json = json.dumps(cluster.to_json(), sort_keys=False, indent=4)
cluster_property = property_set.add_property(
"cluster_settings", dtype=np.dtype(np.unicode_)
"cluster_settings", dtype=np.dtype(np.str_)
)
cluster_property.value.expand(1)[:] = np.array([cluster_json.encode("utf8")])

benchmark_json = json.dumps(benchmark.to_json(), sort_keys=False, indent=4)
benchmark_property = property_set.add_property(
"benchmark_settings", dtype=np.dtype(np.unicode_)
"benchmark_settings", dtype=np.dtype(np.str_)
)
benchmark_property.value.expand(1)[:] = np.array([benchmark_json.encode("utf8")])

experiment_json = json.dumps(experiment.to_json(), sort_keys=False, indent=4)
experiment_property = property_set.add_property(
"experiment_settings", dtype=np.dtype(np.unicode_)
"experiment_settings", dtype=np.dtype(np.str_)
)
experiment_property.value.expand(1)[:] = np.array([experiment_json.encode("utf8")])

Expand All @@ -39,7 +39,7 @@ def write_script(lue_dataset, script):
ldm.assert_is_valid(lue_dataset)

script_property = lue_dataset.benchmark.meta_information.add_property(
"script", dtype=np.dtype(np.unicode_)
"script", dtype=np.dtype(np.str_)
)
script_property.value.expand(1)[:] = np.array([script.encode("utf8")])

Expand Down
4 changes: 2 additions & 2 deletions source/qa/script/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_scalability
OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_scalability.py
INPUT lue_scalability.py
)


lue_install_programs(TARGETS
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_scalability
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/$<$<BOOL:${LUE_GENERATOR_IS_MULTI_CONFIG}>:$<CONFIG>>/lue_scalability.py
)

0 comments on commit 288d5a7

Please sign in to comment.