This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from fredrikaverpil/tests
Add simple test
- Loading branch information
Showing
27 changed files
with
303 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
src/vcpkg/ports/python3-py3.6.5/0004-Fix-iomodule-for-RS4-SDK.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c | ||
--- a/Modules/_io/_iomodule.c | ||
+++ b/Modules/_io/_iomodule.c | ||
@@ -21,7 +21,7 @@ | ||
#endif /* HAVE_SYS_STAT_H */ | ||
|
||
#ifdef MS_WINDOWS | ||
-#include <consoleapi.h> | ||
+#include <windows.h> | ||
#endif | ||
|
||
/* Various interned strings */ |
12 changes: 12 additions & 0 deletions
12
src/vcpkg/ports/python3-py3.6.5/0005-Fix-DefaultWindowsSDKVersion.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/PCbuild/python.props b/PCbuild/python.props | ||
--- a/PCbuild/python.props | ||
+++ b/PCbuild/python.props | ||
@@ -76,7 +76,7 @@ | ||
--> | ||
<_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion> | ||
<_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\WOW6432Node\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion> | ||
- <DefaultWindowsSDKVersion>10.0.15063.0</DefaultWindowsSDKVersion> | ||
+ <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion> | ||
<DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.14393'">10.0.14393.0</DefaultWindowsSDKVersion> | ||
<DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion> | ||
<DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Source: python3 | ||
Version: 3.6.4-2 | ||
Description: The Python programming language as an embeddable library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static) | ||
message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.") | ||
set(VCPKG_LIBRARY_LINKAGE static) | ||
endif() | ||
|
||
set(PYTHON_VERSION_MAJOR 3) | ||
set(PYTHON_VERSION_MINOR 6) | ||
set(PYTHON_VERSION_PATCH 5) | ||
set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}) | ||
|
||
include(vcpkg_common_functions) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH TEMP_SOURCE_PATH | ||
REPO python/cpython | ||
REF v${PYTHON_VERSION} | ||
SHA512 1fa9188e80d9766c7c13ff292f1f86e31a4ae4979b11cf4c0152ef97c906b4a045627af1c450ef3a46e024b0a79af6ece289d3b83711c9c7a9041c95083b3b16 | ||
HEAD_REF master | ||
) | ||
|
||
if(WIN32) | ||
vcpkg_apply_patches( | ||
SOURCE_PATH ${TEMP_SOURCE_PATH} | ||
PATCHES | ||
${CMAKE_CURRENT_LIST_DIR}/0004-Fix-iomodule-for-RS4-SDK.patch | ||
${CMAKE_CURRENT_LIST_DIR}/0005-Fix-DefaultWindowsSDKVersion.patch | ||
) | ||
endif() | ||
|
||
# We need per-triplet directories because we need to patch the project files differently based on the linkage | ||
# Because the patches patch the same file, they have to be applied in the correct order | ||
set(SOURCE_PATH "${TEMP_SOURCE_PATH}-Lib-${VCPKG_LIBRARY_LINKAGE}-crt-${VCPKG_CRT_LINKAGE}") | ||
file(REMOVE_RECURSE ${SOURCE_PATH}) | ||
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH}) | ||
|
||
if(WIN32) | ||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static) | ||
vcpkg_apply_patches( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PATCHES | ||
${CMAKE_CURRENT_LIST_DIR}/0001-Static-library.patch | ||
) | ||
endif() | ||
if (VCPKG_CRT_LINKAGE STREQUAL static) | ||
vcpkg_apply_patches( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PATCHES | ||
${CMAKE_CURRENT_LIST_DIR}/0002-Static-CRT.patch | ||
) | ||
endif() | ||
endif() | ||
|
||
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") | ||
set(BUILD_ARCH "Win32") | ||
set(OUT_DIR "win32") | ||
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64") | ||
set(BUILD_ARCH "x64") | ||
set(OUT_DIR "amd64") | ||
else() | ||
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") | ||
endif() | ||
|
||
if(WIN32) | ||
vcpkg_build_msbuild( | ||
PROJECT_PATH ${SOURCE_PATH}/PCBuild/pythoncore.vcxproj | ||
PLATFORM ${BUILD_ARCH}) | ||
else() | ||
message(STATUS "Configure ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND ./configure --enable-shared | ||
WORKING_DIRECTORY ${SOURCE_PATH} | ||
) | ||
message(STATUS "Configure ${TARGET_TRIPLET}-dbg done") | ||
|
||
message(STATUS "Build ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND make libpython3.6m.a | ||
WORKING_DIRECTORY ${SOURCE_PATH} | ||
) | ||
message(STATUS "Build ${TARGET_TRIPLET}-dbg done") | ||
endif() | ||
|
||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static) | ||
vcpkg_apply_patches( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PATCHES | ||
${CMAKE_CURRENT_LIST_DIR}/0003-Fix-header-for-static-linkage.patch | ||
) | ||
endif() | ||
|
||
file(GLOB HEADERS ${SOURCE_PATH}/Include/*.h) | ||
if(WIN32) | ||
file(COPY ${HEADERS} ${SOURCE_PATH}/PC/pyconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) | ||
else() | ||
file(COPY ${HEADERS} ${SOURCE_PATH}/pyconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) | ||
endif() | ||
|
||
file(COPY ${SOURCE_PATH}/Lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}) | ||
|
||
if(WIN32) | ||
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) | ||
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) | ||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) | ||
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) | ||
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) | ||
endif() | ||
else() | ||
file(COPY ${SOURCE_PATH}/libpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}m.a DESTINATION ${CURRENT_PACKAGES_DIR}/lib) | ||
endif() | ||
|
||
# Handle copyright | ||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}) | ||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright) | ||
|
||
vcpkg_copy_pdbs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- a/PCbuild/pythoncore.vcxproj | ||
+++ b/PCbuild/pythoncore.vcxproj | ||
@@ -41,7 +41,7 @@ | ||
<Import Project="python.props" /> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Label="Configuration"> | ||
- <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
+ <ConfigurationType>StaticLibrary</ConfigurationType> | ||
<UseOfMfc>false</UseOfMfc> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
@@ -67,13 +67,25 @@ | ||
<ClCompile> | ||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions> | ||
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
- <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
+ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_NO_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName)</AdditionalLibraryDirectories> | ||
<BaseAddress>0x1e000000</BaseAddress> | ||
</Link> | ||
+ <Lib> | ||
+ <TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MachineX86</TargetMachine> | ||
+ </Lib> | ||
+ <Lib> | ||
+ <TargetMachine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">MachineX86</TargetMachine> | ||
+ </Lib> | ||
+ <Lib> | ||
+ <TargetMachine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">MachineX86</TargetMachine> | ||
+ </Lib> | ||
+ <Lib> | ||
+ <TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MachineX86</TargetMachine> | ||
+ </Lib> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClInclude Include="..\Include\abstract.h" /> | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- a/PCbuild/pythoncore.vcxproj | ||
+++ b/PCbuild/pythoncore.vcxproj | ||
@@ -68,6 +68,10 @@ | ||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions> | ||
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_NO_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary> | ||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary> | ||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary> | ||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
-- | ||
|
14 changes: 14 additions & 0 deletions
14
src/vcpkg/ports/python3-py3.7.0/0003-Fix-header-for-static-linkage.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/PC/pyconfig.h b/PC/pyconfig.h | ||
index 64e7aec..aa36745 100644 | ||
--- a/PC/pyconfig.h | ||
+++ b/PC/pyconfig.h | ||
@@ -274,6 +274,7 @@ typedef int pid_t; | ||
|
||
/* For Windows the Python core is in a DLL by default. Test | ||
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ | ||
+#define Py_NO_ENABLE_SHARED | ||
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED) | ||
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */ | ||
# define MS_COREDLL /* deprecated old symbol */ | ||
-- | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Get width and height of EXR image.""" | ||
|
||
import os | ||
|
||
from oiio import OpenImageIO as oiio | ||
|
||
|
||
def image_dimensions(image_filepath): | ||
"""Get image dimensions. | ||
params: | ||
image_filepath: str | ||
returns | ||
int, int: width, height | ||
""" | ||
img_src = oiio.ImageBuf(image_filepath) | ||
rgb_img_src = oiio.ImageBuf() | ||
oiio.ImageBufAlgo.channels(rgb_img_src, img_src, (0, 1, 2)) | ||
|
||
img_width = rgb_img_src.spec().full_width | ||
img_height = rgb_img_src.spec().full_height | ||
|
||
return img_width, img_height | ||
|
||
|
||
def test_answer(): | ||
"""Verify image dimensions.""" | ||
image_filepath = os.path.join( | ||
os.path.dirname(__file__), "img", "test_image_01.exr" | ||
) | ||
img_width, img_height = image_dimensions(image_filepath) | ||
assert img_width == 1024 | ||
assert img_height == 1024 |
Oops, something went wrong.