Skip to content

Commit

Permalink
Merge pull request #1506 from serpilliere/updt_llvm_ci
Browse files Browse the repository at this point in the history
Fix distutils
  • Loading branch information
serpilliere authored Jan 26, 2025
2 parents 0164999 + d9fb6d5 commit 2a15c60
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 37 deletions.
31 changes: 11 additions & 20 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.{build}
image: Visual Studio 2022

configuration:
- Release
Expand All @@ -7,38 +7,29 @@ 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"

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

install:
- 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"

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"

test_script:
- cmd: cd c:\projects\miasm\test
- "%PYTHON%\\python.exe -W error test_all.py"
- "%PYTHON%\\python.exe -W error test_all.py -t gcc"

after_test:
- cmd: chdir
- cmd: set plat
- cmd: if "%platform%"=="Win32" 7z a -t7z ..\miasm.x86.release.7z c:\projects\miasm\build\*lib*
- cmd: if "%platform%"=="X64" 7z a -t7z ..\miasm.x64.release.7z c:\projects\miasm\build\*lib*

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10', '3.13']

steps:

Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions miasm/jitter/jitcore_cc_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions miasm/jitter/jitcore_gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion optional_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pycparser
z3-solver==4.8.7.0
llvmlite==0.38.0
llvmlite==0.44.0
parameterized~=0.8.1
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
setuptools
pyparsing>=2.4.1
future
15 changes: 7 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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), "..", ".."))
Expand Down Expand Up @@ -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 True:#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:
Expand All @@ -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.
Expand All @@ -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")
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class ExampleJitterNoPython(ExampleJitter):
## Toshiba MeP
testset += RegressionTest(["launch.py"], base_dir="arch/mep/asm")
testset += RegressionTest(["launch.py"], base_dir="arch/mep/ir")
testset += RegressionTest(["launch.py"], base_dir="arch/mep/jit")
testset += RegressionTest(["launch.py"], base_dir="arch/mep/jit", tags=[TAGS["gcc"]])


# region Unittest compatibility
Expand Down

0 comments on commit 2a15c60

Please sign in to comment.