Skip to content

Commit a27077d

Browse files
committed
Fix distutils
1 parent 0164999 commit a27077d

File tree

7 files changed

+32
-34
lines changed

7 files changed

+32
-34
lines changed

.appveyor.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.{build}
1+
image: Visual Studio 2022
22

33
configuration:
44
- Release
@@ -7,28 +7,28 @@ clone_folder: c:\projects\miasm
77

88
environment:
99
matrix:
10-
- platform: Win32
11-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
12-
PLATFORM_TOOLSET: v141
13-
PYTHON: c:\Python38
14-
PYTHON_VERSION: "3.8.x"
15-
16-
- platform: x64
17-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
18-
PLATFORM_TOOLSET: v141
19-
PYTHON: c:\Python38-x64
20-
PYTHON_VERSION: "3.8.x"
21-
# on_finish:
22-
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
10+
- PYTHON: "C:\\Python312-x64"
11+
PYTHON_VERSION: "3.12.x"
12+
PYTHON_ARCH: "64"
13+
14+
- PYTHON: "C:\\Python312"
15+
PYTHON_VERSION: "3.12.x"
16+
PYTHON_ARCH: "32"
17+
18+
init:
19+
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
20+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
2321

2422
install:
23+
- cmd: dir c:\
2524
- cmd: cd c:\projects\miasm
26-
- cmd: "%PYTHON%\\python.exe -m pip install -r requirements.txt"
27-
- cmd: "%PYTHON%\\python.exe -m pip install -r optional_requirements.txt"
25+
- cmd: "python.exe -m pip install -r requirements.txt"
26+
- cmd: "python.exe -m pip install -r optional_requirements.txt"
27+
- cmd: dir "C:\Program Files"
28+
- cmd: dir "C:\Program Files (x86)"
29+
- cmd: dir "C:\Program Files (x86)\Microsoft Visual Studio"
2830

2931
build_script:
30-
- cmd: if "%platform%"=="Win32" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
31-
- cmd: if "%platform%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
3232
- "%PYTHON%\\python.exe setup.py build"
3333
- "%PYTHON%\\python.exe setup.py install"
3434

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ['3.8', '3.10']
10+
python-version: ['3.10', '3.13']
1111

1212
steps:
1313

@@ -25,8 +25,8 @@ jobs:
2525
- name: Install requirements
2626
run: pip install -r requirements.txt
2727

28-
- name: Install llvm 11 (llvmlite compatible)
29-
run: sudo apt-get install llvm-11
28+
- name: Install llvm 15 (llvmlite compatible)
29+
run: sudo apt-get install llvm-15
3030

3131
- name: Install optional requirements
3232
run: pip install -r optional_requirements.txt

miasm/jitter/jitcore_cc_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import tempfile
66
import platform
77
import sysconfig
8-
from distutils.sysconfig import get_python_inc
98

109
from miasm.jitter.jitcore import JitCore
1110
from miasm.core.utils import keydefaultdict
@@ -95,7 +94,7 @@ def load(self):
9594

9695
include_files = [
9796
os.path.dirname(__file__),
98-
get_python_inc()
97+
sysconfig.get_paths()['include'],
9998
]
10099
self.include_files = include_files
101100
self.libs = libs

miasm/jitter/jitcore_gcc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import platform
99
import sysconfig
1010
from subprocess import check_call
11-
from distutils.sysconfig import get_python_inc
1211
from miasm.jitter import Jitgcc
1312
from miasm.jitter.jitcore_cc_base import JitCore_Cc_Base, gen_core
1413

@@ -68,7 +67,7 @@ def add_block(self, block):
6867
if is_win:
6968
libs.append(
7069
os.path.join(
71-
get_python_inc(),
70+
sysconfig.get_paths()['include'],
7271
"..",
7372
"libs",
7473
"python%d%d.lib" % (sys.version_info.major, sys.version_info.minor)

optional_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pycparser
22
z3-solver==4.8.7.0
3-
llvmlite==0.38.0
3+
llvmlite==0.44.0
44
parameterized~=0.8.1

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
setuptools
12
pyparsing>=2.4.1
23
future

setup.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
from distutils.sysconfig import get_python_lib, get_config_vars
88
from distutils.dist import DistributionMetadata
99
from distutils.command.install_data import install_data
10-
from distutils.spawn import find_executable
1110
import subprocess
1211
from tempfile import TemporaryFile
1312
import fnmatch
1413
import io
1514
import os
1615
import platform
17-
from shutil import copy2, copyfile, rmtree
16+
from shutil import copy2, copyfile, rmtree, which
1817
import sys
1918
import tempfile
2019
import atexit
@@ -58,7 +57,7 @@ def win_find_clang_path():
5857
return winreg.QueryValueEx(rkey, None)[0]
5958
except FileNotFoundError:
6059
# Visual Studio ships with an optional Clang distribution, try to detect it
61-
clang_cl = find_executable("clang-cl")
60+
clang_cl = which("clang-cl")
6261
if clang_cl is None:
6362
return None
6463
return os.path.abspath(os.path.join(os.path.dirname(clang_cl), "..", ".."))
@@ -93,7 +92,7 @@ def win_use_clang():
9392

9493
# If you run the installation from a Visual Studio command prompt link.exe will already exist
9594
# Fall back to LLVM's lld-link.exe which is compatible with link's command line
96-
if find_executable("link") is None:
95+
if which("link") is None:
9796
# LLVM >= 14.0.0 started supporting the /LTCG flag
9897
# Earlier versions will error during the linking phase so bail out now
9998
if clang_version[0] < 14:
@@ -110,7 +109,7 @@ def win_use_clang():
110109
build_warnings = []
111110
win_force_clang = False
112111
if is_win:
113-
if is_64bit or find_executable("cl") is None:
112+
if is_64bit or which("cl") is None:
114113
# We do not change to clang if under 32 bits, because even with Clang we
115114
# do not use uint128_t with the 32 bits ABI. Regardless we can try to
116115
# 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():
119118
build_warnings.append("Could not find a suitable Clang/LLVM installation. You can download LLVM from https://releases.llvm.org")
120119
build_warnings.append("Alternatively you can select the 'C++ Clang-cl build tools' in the Visual Studio Installer")
121120
build_extensions = False
122-
cl = find_executable("cl")
123-
link = find_executable("link")
121+
cl = which("cl")
122+
link = which("link")
124123
if cl is None or link is None:
125124
build_warnings.append("Could not find cl.exe and/or link.exe in the PATH, try building miasm from a Visual Studio command prompt")
126125
build_warnings.append("More information at: https://wiki.python.org/moin/WindowsCompilers")
@@ -314,7 +313,7 @@ def build_all():
314313
try:
315314
s = setup(
316315
name = "miasm",
317-
version = __import__("miasm").VERSION,
316+
version = "0.1.5",
318317
packages = packages,
319318
data_files=[("", ["README.md"])],
320319
package_data = {

0 commit comments

Comments
 (0)