diff --git a/.appveyor.yml b/.appveyor.yml index 2d6731939..efcc0b19d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -version: 1.{build} +image: Visual Studio 2022 configuration: - Release @@ -7,28 +7,33 @@ clone_folder: c:\projects\miasm environment: matrix: - - platform: Win32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PLATFORM_TOOLSET: v141 - PYTHON: c:\Python38 - PYTHON_VERSION: "3.8.x" - - - platform: x64 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PLATFORM_TOOLSET: v141 - PYTHON: c:\Python38-x64 - PYTHON_VERSION: "3.8.x" - # on_finish: - # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - PYTHON: "C:\\Python312-x64" + PYTHON_VERSION: "3.12.x" + PYTHON_ARCH: "64" + + - PYTHON: "C:\\Python312" + PYTHON_VERSION: "3.12.x" + PYTHON_ARCH: "32" + +init: + - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" install: + - cmd: dir c:\ - cmd: cd c:\projects\miasm - - cmd: "%PYTHON%\\python.exe -m pip install -r requirements.txt" - - cmd: "%PYTHON%\\python.exe -m pip install -r optional_requirements.txt" + - cmd: "python.exe -m pip install -r requirements.txt" + - cmd: "python.exe -m pip install -r optional_requirements.txt" + - cmd: where clang.exe + - cmd: where lld.exe + - cmd: dir "C:\Program Files" + - cmd: dir "C:\Program Files\LLVM" + - cmd: dir "C:\Program Files\Microsoft Visual Studio" + - cmd: dir "C:\Program Files\Microsoft Visual Studio\2022" + - cmd: dir "C:\Program Files (x86)" + - cmd: dir "C:\Program Files (x86)\Microsoft Visual Studio" build_script: - - cmd: if "%platform%"=="Win32" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 - - cmd: if "%platform%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 - "%PYTHON%\\python.exe setup.py build" - "%PYTHON%\\python.exe setup.py install" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3d609cdb4..9a6cb9b7d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.10'] + python-version: ['3.10', '3.13'] steps: @@ -25,8 +25,8 @@ jobs: - name: Install requirements run: pip install -r requirements.txt - - name: Install llvm 11 (llvmlite compatible) - run: sudo apt-get install llvm-11 + - name: Install llvm 15 (llvmlite compatible) + run: sudo apt-get install llvm-15 - name: Install optional requirements run: pip install -r optional_requirements.txt diff --git a/miasm/jitter/jitcore_cc_base.py b/miasm/jitter/jitcore_cc_base.py index a6c7607af..c5819d1f5 100644 --- a/miasm/jitter/jitcore_cc_base.py +++ b/miasm/jitter/jitcore_cc_base.py @@ -5,7 +5,6 @@ import tempfile import platform import sysconfig -from distutils.sysconfig import get_python_inc from miasm.jitter.jitcore import JitCore from miasm.core.utils import keydefaultdict @@ -95,7 +94,7 @@ def load(self): include_files = [ os.path.dirname(__file__), - get_python_inc() + sysconfig.get_paths()['include'], ] self.include_files = include_files self.libs = libs diff --git a/miasm/jitter/jitcore_gcc.py b/miasm/jitter/jitcore_gcc.py index 365e00f7b..958c9d13f 100644 --- a/miasm/jitter/jitcore_gcc.py +++ b/miasm/jitter/jitcore_gcc.py @@ -8,7 +8,6 @@ import platform import sysconfig from subprocess import check_call -from distutils.sysconfig import get_python_inc from miasm.jitter import Jitgcc from miasm.jitter.jitcore_cc_base import JitCore_Cc_Base, gen_core @@ -68,7 +67,7 @@ def add_block(self, block): if is_win: libs.append( os.path.join( - get_python_inc(), + sysconfig.get_paths()['include'], "..", "libs", "python%d%d.lib" % (sys.version_info.major, sys.version_info.minor) diff --git a/optional_requirements.txt b/optional_requirements.txt index 950818553..35cdab386 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,4 +1,4 @@ pycparser z3-solver==4.8.7.0 -llvmlite==0.38.0 +llvmlite==0.44.0 parameterized~=0.8.1 diff --git a/requirements.txt b/requirements.txt index b518400d0..028b73e48 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +setuptools pyparsing>=2.4.1 future diff --git a/setup.py b/setup.py index abecb1a13..344bec438 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,13 @@ from distutils.sysconfig import get_python_lib, get_config_vars from distutils.dist import DistributionMetadata from distutils.command.install_data import install_data -from distutils.spawn import find_executable import subprocess from tempfile import TemporaryFile import fnmatch import io import os import platform -from shutil import copy2, copyfile, rmtree +from shutil import copy2, copyfile, rmtree, which import sys import tempfile import atexit @@ -58,7 +57,7 @@ def win_find_clang_path(): return winreg.QueryValueEx(rkey, None)[0] except FileNotFoundError: # Visual Studio ships with an optional Clang distribution, try to detect it - clang_cl = find_executable("clang-cl") + clang_cl = which("clang-cl") if clang_cl is None: return None return os.path.abspath(os.path.join(os.path.dirname(clang_cl), "..", "..")) @@ -93,7 +92,7 @@ def win_use_clang(): # If you run the installation from a Visual Studio command prompt link.exe will already exist # Fall back to LLVM's lld-link.exe which is compatible with link's command line - if find_executable("link") is None: + if which("link") is None: # LLVM >= 14.0.0 started supporting the /LTCG flag # Earlier versions will error during the linking phase so bail out now if clang_version[0] < 14: @@ -110,7 +109,7 @@ def win_use_clang(): build_warnings = [] win_force_clang = False if is_win: - if is_64bit or find_executable("cl") is None: + if is_64bit or which("cl") is None: # We do not change to clang if under 32 bits, because even with Clang we # do not use uint128_t with the 32 bits ABI. Regardless we can try to # find it when building in 32-bit mode if cl.exe was not found in the PATH. @@ -119,8 +118,8 @@ def win_use_clang(): build_warnings.append("Could not find a suitable Clang/LLVM installation. You can download LLVM from https://releases.llvm.org") build_warnings.append("Alternatively you can select the 'C++ Clang-cl build tools' in the Visual Studio Installer") build_extensions = False - cl = find_executable("cl") - link = find_executable("link") + cl = which("cl") + link = which("link") if cl is None or link is None: build_warnings.append("Could not find cl.exe and/or link.exe in the PATH, try building miasm from a Visual Studio command prompt") build_warnings.append("More information at: https://wiki.python.org/moin/WindowsCompilers") @@ -314,7 +313,7 @@ def build_all(): try: s = setup( name = "miasm", - version = __import__("miasm").VERSION, + version = "0.1.5", packages = packages, data_files=[("", ["README.md"])], package_data = {