Skip to content

Commit

Permalink
Fix format of pip metadata on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Sep 25, 2024
1 parent bb2b42d commit 9836f84
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
2 changes: 0 additions & 2 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ if(HDE_COMPILE_PYTHON_BINDINGS)

find_package(pybind11 2.4.3 CONFIG REQUIRED)

set(NEW_LINE "\n")

option(HDE_DETECT_ACTIVE_PYTHON_SITEPACKAGES
"Do you want HDE to detect and use the active site-package directory? (it could be a system dir)"
FALSE)
Expand Down
15 changes: 5 additions & 10 deletions bindings/python-hde/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install(TARGETS pybind11_hde DESTINATION ${PYTHON_INSTDIR})
# Create the __init__.py file
file(GENERATE
OUTPUT "${HDE_PYTHON_PACKAGE}/__init__.py"
CONTENT "from .bindings import *${NEW_LINE}")
CONTENT "from .bindings import *\n")
# Install the __init__.py file
install(FILES "${HDE_PYTHON_PACKAGE}/__init__.py"
DESTINATION ${PYTHON_INSTDIR})
Expand All @@ -51,16 +51,11 @@ install(FILES "${HDE_PYTHON_PACKAGE}/__init__.py"
# and https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata
if(HDE_PYTHON_PIP_METADATA_INSTALL)
get_filename_component(PYTHON_METADATA_PARENT_DIR ${PYTHON_INSTDIR} DIRECTORY)
if(WIN32)
set(NEW_LINE "\n\r")
else()
set(NEW_LINE "\n")
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/METADATA "")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Metadata-Version: 2.1${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Name: hde${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Version: ${PROJECT_VERSION}${NEW_LINE}")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/INSTALLER "${HDE_PYTHON_PIP_METADATA_INSTALLER}${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Metadata-Version: 2.1\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Name: hde\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Version: ${PROJECT_VERSION}\n")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/INSTALLER "${HDE_PYTHON_PIP_METADATA_INSTALLER}\n")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/METADATA" "${CMAKE_CURRENT_BINARY_DIR}/INSTALLER"
DESTINATION ${PYTHON_METADATA_PARENT_DIR}/hde-${PROJECT_VERSION}.dist-info)
Expand Down
13 changes: 4 additions & 9 deletions bindings/python-wearables/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,11 @@ set(HDE_PYTHON_PIP_METADATA_INSTALLER "cmake" CACHE STRING "Specify the string t
mark_as_advanced(HDE_PYTHON_PIP_METADATA_INSTALLER)
if(HDE_PYTHON_PIP_METADATA_INSTALL)
get_filename_component(PYTHON_METADATA_PARENT_DIR ${PYTHON_INSTDIR} DIRECTORY)
if(WIN32)
set(NEW_LINE "\n\r")
else()
set(NEW_LINE "\n")
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/METADATA "")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Metadata-Version: 2.1${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Name: wearables${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Version: ${PROJECT_VERSION}${NEW_LINE}")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/INSTALLER "${HDE_PYTHON_PIP_METADATA_INSTALLER}${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Metadata-Version: 2.1\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Name: wearables\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Version: ${PROJECT_VERSION}\n")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/INSTALLER "${HDE_PYTHON_PIP_METADATA_INSTALLER}\n")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/METADATA" "${CMAKE_CURRENT_BINARY_DIR}/INSTALLER"
DESTINATION ${PYTHON_METADATA_PARENT_DIR}/wearables-${PROJECT_VERSION}.dist-info)
Expand Down

0 comments on commit 9836f84

Please sign in to comment.