1
0
mirror of synced 2024-11-28 01:20:51 +01:00

build: Removed all usages of Python

This commit is contained in:
WerWolv 2022-12-29 23:32:57 +01:00
parent b4fa8bebe9
commit 85823e8e5d
20 changed files with 24 additions and 109 deletions

View File

@ -52,31 +52,6 @@ macro(addVersionDefines)
endmacro()
macro(configurePython)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
# Enforce that we use non system Python 3 on macOS.
set(Python_FIND_FRAMEWORK NEVER)
find_package(Python COMPONENTS Development REQUIRED)
if(Python_VERSION LESS 3)
message(STATUS ${PYTHON_VERSION_MAJOR_MINOR})
message(FATAL_ERROR "No valid version of Python 3 was found.")
endif()
string(REPLACE "." ";" PYTHON_VERSION_MAJOR_MINOR ${Python_VERSION})
list(LENGTH PYTHON_VERSION_MAJOR_MINOR PYTHON_VERSION_COMPONENT_COUNT)
if (PYTHON_VERSION_COMPONENT_COUNT EQUAL 3)
list(REMOVE_AT PYTHON_VERSION_MAJOR_MINOR 2)
endif ()
list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
add_compile_definitions(PYTHON_VERSION_MAJOR_MINOR="${PYTHON_VERSION_MAJOR_MINOR}")
endmacro()
# Detect current OS / System
macro(detectOS)
if (WIN32)
@ -223,7 +198,6 @@ macro(createPackage)
# Grab all dynamically linked dependencies.
INSTALL(CODE "set(CMAKE_INSTALL_BINDIR \"${CMAKE_INSTALL_BINDIR}\")")
INSTALL(CODE "get_filename_component(PY_PARENT \"${Python_LIBRARIES}\" DIRECTORY)")
INSTALL(CODE "LIST(APPEND DEP_FOLDERS \${PY_PARENT})")
install(CODE [[
file(GET_RUNTIME_DEPENDENCIES

View File

@ -46,7 +46,7 @@ endfunction()
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle("${BUNDLE_PATH}" "${extra_libs}" "${extra_dirs}" IGNORE_ITEM "Python")
fixup_bundle("${BUNDLE_PATH}" "${extra_libs}" "${extra_dirs}")
if (CODE_SIGN_CERTIFICATE_ID)
# Hack around Apple Silicon signing bugs by copying the real app, signing it and moving it back.

View File

@ -107,7 +107,6 @@ AppDir:
- /lib/x86_64-linux-gnu/libpcre2-8.so.0
- /lib/x86_64-linux-gnu/libpixman-1.so.0
- /lib/x86_64-linux-gnu/libpng16.so.16
- /lib/x86_64-linux-gnu/libpython3.10.so.1.0
- /lib/x86_64-linux-gnu/libsasl2.so.2
- /lib/x86_64-linux-gnu/libsensors.so.5
- /lib/x86_64-linux-gnu/libstdc++.so.6

2
dist/Arch/PKGBUILD vendored
View File

@ -8,7 +8,7 @@ pkgdesc="A Hex Editor for Reverse Engineers, Programmers and people who value th
arch=("x86_64")
url="https://github.com/WerWolv/ImHex"
license=('GPL2')
depends=(glfw mbedtls python freetype2 libglvnd dbus xdg-desktop-portal curl fmt yara nlohmann-json)
depends=(glfw mbedtls freetype2 libglvnd dbus xdg-desktop-portal curl fmt yara nlohmann-json)
makedepends=(git)
provides=(imhex)
conflicts=(imhex)

1
dist/Brewfile vendored
View File

@ -2,7 +2,6 @@ brew "mbedtls"
brew "nlohmann-json"
brew "cmake"
brew "ccache"
brew "python3"
brew "freetype2"
brew "libmagic"
brew "pkg-config"

View File

@ -4,7 +4,7 @@ Section: editors
Priority: optional
Architecture: amd64
License: GNU GPL-2
Depends: libglfw3, libmagic1, libmbedtls14, libpython3.10, libfreetype6, libopengl0, libdbus-1-3, xdg-desktop-portal
Depends: libglfw3, libmagic1, libmbedtls14, libfreetype6, libopengl0, libdbus-1-3, xdg-desktop-portal
Maintainer: WerWolv <hey@werwolv.net>
Description: ImHex Hex Editor
A Hex Editor for Reverse Engineers, Programmers and

1
dist/Dockerfile vendored
View File

@ -13,7 +13,6 @@ RUN pacman -S --needed --noconfirm \
glfw-x11 \
file \
mbedtls \
python3 \
freetype2 \
dbus \
xdg-desktop-portal

View File

@ -9,20 +9,15 @@ HOMEPAGE="https://github.com/WerWolv/ImHex"
SRC_URI=""
EGIT_REPO_URI="https://github.com/WerWolv/ImHex.git"
PYTHON_COMPAT=( python3_{6,7,8,9} )
inherit git-r3 python-single-r1 cmake
inherit git-r3 cmake
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
DEPEND=""
RDEPEND="${DEPEND}
${PYTHON_DEPS}
media-libs/glfw
sys-apps/file
dev-libs/mbedtls

View File

@ -7,7 +7,6 @@ pacman -S $@ --needed \
glfw \
file \
mbedtls \
python3 \
freetype2 \
dbus \
xdg-desktop-portal \

View File

@ -19,7 +19,6 @@ apt install -y \
libglm-dev \
libmagic-dev \
libmbedtls-dev \
python3-dev \
libfreetype-dev \
libdbus-1-dev \
xdg-desktop-portal

View File

@ -10,5 +10,4 @@ dnf install -y \
mesa-libGL-devel \
glfw-devel \
lld \
mbedtls-devel \
python3-devel
mbedtls-devel

View File

@ -9,6 +9,5 @@ pacman -S --needed --noconfirm \
mingw-w64-x86_64-glfw \
mingw-w64-x86_64-file \
mingw-w64-x86_64-mbedtls \
mingw-w64-x86_64-python \
mingw-w64-x86_64-freetype \
mingw-w64-x86_64-dlfcn

2
dist/msys2/PKGBUILD vendored
View File

@ -7,7 +7,6 @@ pkgdesc="${_realname}: a Hex Editor for Reverse Engineers, Programmers and peopl
arch=('any')
url="https://github.com/WerWolv/ImHex"
license=('GPLv2')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-lld"
"${MINGW_PACKAGE_PREFIX}-cmake"
@ -17,7 +16,6 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-file"
"${MINGW_PACKAGE_PREFIX}-mbedtls"
"${MINGW_PACKAGE_PREFIX}-polly"
"${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-freetype")
source=()

1
dist/rpm/imhex.spec vendored
View File

@ -19,7 +19,6 @@ BuildRequires: json-devel
BuildRequires: libcurl-devel
BuildRequires: llvm-devel
BuildRequires: mbedtls-devel
BuildRequires: python3-devel
%if 0%{?fedora} >= 37
BuildRequires: yara-devel
%endif

View File

@ -90,7 +90,6 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/pattern_language ${CMAK
set_target_properties(libpl PROPERTIES POSITION_INDEPENDENT_CODE ON)
find_package(mbedTLS 2.26.0 REQUIRED)
configurePython()
pkg_search_module(MAGIC libmagic>=5.39)
if(NOT MAGIC_FOUND)
@ -162,7 +161,7 @@ add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
set_target_properties(libimhex PROPERTIES POSITION_INDEPENDENT_CODE ON)
setupCompilerWarnings(libimhex)
target_include_directories(libimhex PUBLIC include ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${YARA_INCLUDE_DIRS})
target_include_directories(libimhex PUBLIC include ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${YARA_INCLUDE_DIRS})
target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR} ${CAPSTONE_LIBRARY_DIRS} ${MAGIC_LIBRARY_DIRS})
if (APPLE)
@ -170,4 +169,4 @@ if (APPLE)
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
endif ()
target_link_libraries(libimhex PUBLIC dl imgui ${NFD_LIBRARIES} magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES} libpl intervaltree)
target_link_libraries(libimhex PUBLIC dl imgui ${NFD_LIBRARIES} magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} libpl intervaltree)

View File

@ -90,7 +90,6 @@ namespace hex::fs {
Patterns = 0,
PatternsInclude,
Magic,
Python,
Plugins,
Yara,
Config,

View File

@ -238,9 +238,6 @@ namespace hex::fs {
case ImHexPath::PatternsInclude:
result = appendPath(getDataPaths(), "includes");
break;
case ImHexPath::Python:
result = appendPath(getDataPaths(), "python");
break;
case ImHexPath::Yara:
result = appendPath(getDataPaths(), "yara");
break;

View File

@ -130,7 +130,6 @@ namespace hex::plugin::builtin {
link("GNU libmagic", "", "https://www.darwinsys.com/file/");
link("GLFW3", "", "https://github.com/glfw/glfw/");
link("LLVM", "", "https://github.com/llvm/llvm-project/");
link("Python 3", "", "https://github.com/python/cpython/");
ImGui::PopStyleColor();
@ -143,15 +142,23 @@ namespace hex::plugin::builtin {
ImGui::TableSetupColumn("Type");
ImGui::TableSetupColumn("Paths");
constexpr static std::array<std::pair<const char *, fs::ImHexPath>, 8> PathTypes = {
{{ "Resources", fs::ImHexPath::Resources },
{ "Config", fs::ImHexPath::Config },
{ "Magic", fs::ImHexPath::Magic },
{ "Patterns", fs::ImHexPath::Patterns },
{ "Patterns Includes", fs::ImHexPath::PatternsInclude },
{ "Plugins", fs::ImHexPath::Plugins },
{ "Python Scripts", fs::ImHexPath::Python },
{ "Yara Patterns", fs::ImHexPath::Yara }}
constexpr static std::array<std::pair<const char *, fs::ImHexPath>, u32(fs::ImHexPath::END)> PathTypes = {
{
{ "Patterns", fs::ImHexPath::Patterns },
{ "Patterns Includes", fs::ImHexPath::PatternsInclude },
{ "Magic", fs::ImHexPath::Magic },
{ "Plugins", fs::ImHexPath::Plugins },
{ "Yara Patterns", fs::ImHexPath::Yara },
{ "Config", fs::ImHexPath::Config },
{ "Resources", fs::ImHexPath::Resources },
{ "Constants lists", fs::ImHexPath::Constants },
{ "Custom encodings", fs::ImHexPath::Encodings },
{ "Logs", fs::ImHexPath::Logs },
{ "Recent files", fs::ImHexPath::Recent },
{ "Scripts", fs::ImHexPath::Scripts },
{ "Themes", fs::ImHexPath::Themes },
{ "Data inspector scripts", fs::ImHexPath::Inspectors },
}
};
ImGui::TableHeadersRow();

View File

@ -1,2 +0,0 @@
from _imhex import *
import imhex_python.types as types

View File

@ -1,44 +0,0 @@
class ImHexTypeMeta(type):
def __new__(cls, name, bases, dct):
return super().__new__(cls, name, bases, dct)
def __getitem__(self, value):
return array(self, value)
class ImHexType(metaclass=ImHexTypeMeta):
pass
class u8(ImHexType):
pass
class u16(ImHexType):
pass
class u32(ImHexType):
pass
class u64(ImHexType):
pass
class u128(ImHexType):
pass
class s8(ImHexType):
pass
class s16(ImHexType):
pass
class s32(ImHexType):
pass
class s64(ImHexType):
pass
class s128(ImHexType):
pass
class float(ImHexType):
pass
class double(ImHexType):
pass
class array(ImHexType):
def __init__(self, array_type, size):
self.array_type = array_type()
self.size = size
array_type : type
size : int