Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add linux aarch64 wheel #2103

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 0 additions & 85 deletions .ci/appveyor/install.ps1

This file was deleted.

100 changes: 67 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# * Linux
# * macOS
# * Windows (disabled)
# * Windows
# * FreeBSD
#
# To skip certain builds see:
Expand All @@ -20,25 +20,19 @@
on: [push, pull_request]
name: build
jobs:
# Linux + macOS + Python 3
linux-macos-py3:
name: ${{ matrix.os }}-py3
# Linux + macOS + Windows CPython 3.6+
cp36:
name: cp36+, ${{ matrix.os }}, ${{ matrix.archs }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-10.15]
include:
- {name: Linux, python: '3.9', os: ubuntu-latest}
env:
CIBW_TEST_COMMAND:
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
CIBW_TEST_EXTRAS: test
CIBW_BUILD: 'cp36-* cp37-* cp38-* cp39-* cp310-*'
CIBW_SKIP: '*-musllinux_*'
- {os: macos-11, archs: "x86_64 universal2"}
- {os: ubuntu-20.04, archs: "x86_64 i686"}
- {os: ubuntu-20.04, archs: "aarch64"}
- {os: windows-2019, archs: "AMD64 x86"}

steps:
- name: Cancel previous runs
Expand All @@ -53,16 +47,16 @@ jobs:
cache: pip
cache-dependency-path: .github/workflows/build.yml

- name: Install cibuildwheel
run: pip install cibuildwheel

# - name: (Windows) install Visual C++ for Python 2.7
# if: matrix.os == 'windows-latest'
# run: |
# choco install vcpython27 -f -y
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: matrix.archs == 'aarch64'

- name: Run tests
run: cibuildwheel .
uses: pypa/[email protected]
with:
config-file: "./cibuildwheel.toml"
env:
CIBW_ARCHS: ${{ matrix.archs }}

- name: Create wheels
uses: actions/upload-artifact@v3
Expand All @@ -78,25 +72,65 @@ jobs:
mv dist/psutil*.tar.gz wheelhouse/
python scripts/internal/print_hashes.py wheelhouse/

# Linux + macOS + Python 2
linux-macos-py2:
name: ${{ matrix.os }}-py2
# Windows cp37+ tests
# psutil tests do not like running from a virtualenv with python>=3.7 so
# not using cibuildwheel for those. run them "manually" with this job.
windows-cp3-test:
name: windows tests ${{ matrix.python }} ${{ matrix.architecture }}
needs: cp36
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
architecture: ["x86", "x64"]

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "${{ matrix.python }}"
architecture: "${{ matrix.architecture }}"
cache: pip
cache-dependency-path: .github/workflows/build.yml
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- name: Run tests
run: |
mkdir .tests
cd .tests
pip install $(find ../wheelhouse -name '*-cp36-abi3-${{ matrix.architecture == 'x86' && 'win32' || 'win_amd64'}}.whl')[test]
export PYTHONWARNINGS=always
export PYTHONUNBUFFERED=1
export PSUTIL_DEBUG=1
python ../psutil/tests/runner.py
python ../psutil/tests/test_memleaks.py
shell: bash

# Linux + macOS + CPython 2.7 & 3.5
linux-macos-cp27-cp35:
name: cp27/cp35, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-10.15]
include:
- {name: Linux, python: '3.9', os: ubuntu-latest}
os: [ubuntu-20.04, macos-11]
env:
CIBW_ARCHS_LINUX: 'x86_64 i686'
CIBW_TEST_COMMAND:
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
CIBW_TEST_EXTRAS: test
CIBW_BUILD: 'cp27-*'
CIBW_SKIP: '*-musllinux_*'
CIBW_BUILD: 'cp27-* cp35-*'
CIBW_SKIP: 'cp35-macosx_x86_64'

steps:
- name: Cancel previous runs
Expand Down Expand Up @@ -132,7 +166,7 @@ jobs:
python scripts/internal/print_hashes.py wheelhouse/

freebsd:
runs-on: macos-10.15
runs-on: macos-12
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ syntax: glob
.tox/
build/
dist/
wheelhouse/
45 changes: 0 additions & 45 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,62 +24,17 @@ environment:
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python38"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python39"
PYTHON_VERSION: "3.9.x"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python310"
PYTHON_VERSION: "3.10.x"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON_ARCH: "32"

# 64 bits

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python39-x64"
PYTHON_VERSION: "3.9.x"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python310-x64"
PYTHON_VERSION: "3.10.x"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON_ARCH: "64"

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"

install:
- "powershell .ci\\appveyor\\install.ps1"
# - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "%WITH_COMPILER% %PYTHON%/python.exe -m pip --version"
- "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user setuptools pip"
- "%WITH_COMPILER% %PYTHON%/python.exe scripts/internal/winmake.py setup-dev-env"
Expand Down
28 changes: 28 additions & 0 deletions cibuildwheel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.cibuildwheel]
skip = ["pp*", "*-musllinux*"]
test-extras = "test"
test-command = [
"PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py",
"PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py"
]

[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2"]

[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.9"

[tool.cibuildwheel.windows]
# psutil tests do not like running from a virtualenv with python>=3.7
# restrict build & tests to cp36
# cp36-abi3 wheels will need to be tested outside cibuildwheel for python>=3.7
build = "cp36-*"
test-command = [
"python {project}/psutil/tests/runner.py",
"python {project}/psutil/tests/test_memleaks.py"
]

[tool.cibuildwheel.windows.environment]
PYTHONWARNINGS = "always"
PYTHONUNBUFFERED = "1"
PSUTIL_DEBUG = "1"
15 changes: 4 additions & 11 deletions psutil/_psutil_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,29 +298,25 @@ psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args) {
pid_t pid;
int i, seq_len;
PyObject *py_cpu_set;
PyObject *py_cpu_seq = NULL;

if (!PyArg_ParseTuple(args, _Py_PARSE_PID "O", &pid, &py_cpu_set))
return NULL;

if (!PySequence_Check(py_cpu_set)) {
PyErr_Format(PyExc_TypeError, "sequence argument expected, got %s",
Py_TYPE(py_cpu_set)->tp_name);
PyErr_Format(PyExc_TypeError, "sequence argument expected, got %R", Py_TYPE(py_cpu_set));
goto error;
}

py_cpu_seq = PySequence_Fast(py_cpu_set, "expected a sequence or integer");
if (!py_cpu_seq)
goto error;
seq_len = PySequence_Fast_GET_SIZE(py_cpu_seq);
seq_len = PySequence_Size(py_cpu_set);
CPU_ZERO(&cpu_set);
for (i = 0; i < seq_len; i++) {
PyObject *item = PySequence_Fast_GET_ITEM(py_cpu_seq, i);
PyObject *item = PySequence_GetItem(py_cpu_set, i);
#if PY_MAJOR_VERSION >= 3
long value = PyLong_AsLong(item);
#else
long value = PyInt_AsLong(item);
#endif
Py_XDECREF(item);
if ((value == -1) || PyErr_Occurred()) {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_ValueError, "invalid CPU value");
Expand All @@ -335,12 +331,9 @@ psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args) {
goto error;
}

Py_DECREF(py_cpu_seq);
Py_RETURN_NONE;

error:
if (py_cpu_seq != NULL)
Py_DECREF(py_cpu_seq);
return NULL;
}
#endif /* PSUTIL_HAVE_CPU_AFFINITY */
Expand Down
2 changes: 1 addition & 1 deletion psutil/arch/windows/process_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ psutil_get_cmdline(DWORD pid, int use_peb) {
wcslen(szArglist[i]));
if (py_unicode == NULL)
goto out;
PyList_SET_ITEM(py_retlist, i, py_unicode);
PyList_SetItem(py_retlist, i, py_unicode);
py_unicode = NULL;
}
ret = py_retlist;
Expand Down
Loading