Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/giampaolo/psutil: (22 commits)
  use glob.glob() in setup.py
  OSX / refact: get rid of process_info.c (giampaolo#2243)
  OSX C refact: reconstruct _psutil_osx.c to preserve history
  OSX: rename psutil/_psutil_osx.c to arch/osx/proc.c to preserve GIT history
  OSX big C refactoring (giampaolo#2242)
  fix failing users() test; update HISTORY; give CREDITS to @0-wiz-0 for giampaolo#2241
  win C refact: reconstruct _psutil_windows.c trying to preserve history
  rename _psutil_windows.c -> proc.c
  Win, C, refact: move proc funcs into proc.c file
  BSD big refact: move proc funcs in new proc.c file
  Fix build on NetBSD due to missing .h include. (giampaolo#2241)
  Win, C, refact: move boot_time() and users() in new sys.c
  Windows / refact: new sensors.c file
  C refact: remove useless cmdline / cwd / environ layers. Call direct functions
  pre release
  Add CI testing for OpenBSD and NetBSD (giampaolo#2240)
  Fix giampaolo#2239 / proc name(): don't fail with ZombieProcess on cmdline()
  giampaolo#2238: passed wrong value to Py_BuildValue
  fix giampaolo#2238 if cwd() cannot be determined always return "" instead of None
  Fix giampaolo#2237, OpenBSD, cwd(): return None instead of FileNotFoundError
  ...
  • Loading branch information
ddelange committed Apr 21, 2023
2 parents 3a7ea22 + 995fa82 commit 049715e
Show file tree
Hide file tree
Showing 72 changed files with 5,243 additions and 4,970 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Execute tests on *BSD platforms. Does not produce wheels.
# Useful URLs:
# https://github.com/vmactions/freebsd-vm
# https://github.com/vmactions/openbsd-vm
# https://github.com/vmactions/netbsd-vm

on: [push, pull_request]
name: bsd-tests
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
cancel-in-progress: true
jobs:
freebsd:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Run tests
uses: vmactions/freebsd-vm@v0
with:
usesh: true
prepare: |
pkg install -y gcc python3
run: |
set -e -x
make install-pip
python3 -m pip install --user setuptools
make install
make test
make test-memleaks
openbsd:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Run tests
uses: vmactions/openbsd-vm@v0
with:
usesh: true
prepare: |
set -e
pkg_add gcc python3
run: |
set -e
make install-pip
python3 -m pip install --user setuptools
make install
make test
make test-memleaks
netbsd:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Run tests
uses: vmactions/netbsd-vm@v0
with:
usesh: true
prepare: |
set -e
pkg_add -v pkgin
pkgin update
pkgin -y install python311-* py311-setuptools-* gcc12-*
run: |
set -e
make install-pip PYTHON=python3.11
python3.11 -m pip install --user setuptools
make install PYTHON=python3.11
make test PYTHON=python3.11
make test-memleaks PYTHON=python3.11
44 changes: 5 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# Executed on every push by GitHub Actions. This runs CI tests and
# generates wheels (not all) on the following platforms:
# Runs CI tests and generates wheels on the following platforms:
#
# * Linux
# * macOS
# * Windows
# * FreeBSD
# * Linux (py2 and py3)
# * macOS (py2 and py3)
# * Windows (py3, py2 is done by appveyor)
#
# To skip certain builds see:
# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
#
# External GH actions:
# Useful URLs:
# * https://github.com/pypa/cibuildwheel
# * https://github.com/actions/checkout
# * https://github.com/actions/setup-python
# * https://github.com/actions/upload-artifact
# * https://github.com/marketplace/actions/cancel-workflow-action
# * https://github.com/vmactions/freebsd-vm

on:
pull_request:
Expand Down Expand Up @@ -164,34 +158,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

# FreeBSD (tests only)
py3-freebsd:
runs-on: macos-12
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

- name: Run tests
id: test
uses: vmactions/freebsd-vm@v0
with:
usesh: true
prepare: pkg install -y gcc python3
run: |
set +e
export \
PYTHONUNBUFFERED=1 \
PYTHONWARNINGS=always \
PSUTIL_DEBUG=1
python3 -m pip install --user setuptools
python3 setup.py install
python3 psutil/tests/runner.py
python3 psutil/tests/test_memleaks.py
# Run linters
linters:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ I: 18
N: Thomas Klausner
W: https://github.com/0-wiz-0
D: NetBSD implementation (co-author).
I: 557, 2128
I: 557, 2128, 2241

N: Ryo Onodera
W: https://github.com/ryoon
Expand Down
26 changes: 25 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
*Bug tracker at https://github.com/giampaolo/psutil/issues*

5.9.5 (IN DEVELOPMENT)
5.9.6 (IN DEVELOPMENT)
======================

XXXX-XX-XX

- 2241_, [NetBSD]: can't compile On NetBSD 10.99.3/amd64. (patch by Thomas
Klausner)

5.9.5
=====

2023-04-17

**Enhancements**

- 2196_: in case of exception, display a cleaner error traceback by hiding the
Expand All @@ -15,6 +25,16 @@
empty string)
- The function is faster since it no longer iterates over all processes.
- No longer produces duplicate connection entries.
- 2238_: there are cases where `Process.cwd()`_ cannot be determined
(e.g. directory no longer exists), in which case we returned either ``None``
or an empty string. This was consolidated and we now return ``""`` on all
platforms.
- 2239_, [UNIX]: if process is a zombie, and we can only determine part of the
its truncated `Process.name()`_ (15 chars), don't fail with `ZombieProcess`_
when we try to guess the full name from the `Process.cmdline()`_. Just
return the truncated name.
- 2240_, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and
OpenBSD platforms (python 3 only).

**Bug fixes**

Expand All @@ -37,6 +57,10 @@
- 2231_, [NetBSD]: *available* `virtual_memory()`_ is higher than *total*.
- 2234_, [NetBSD]: `virtual_memory()`_ metrics are wrong: *available* and
*used* are too high. We now match values shown by *htop* CLI utility.
- 2236_, [NetBSD]: `Process.num_threads()`_ and `Process.threads()`_ return
threads that are already terminated.
- 2237_, [OpenBSD], [NetBSD]: `Process.cwd()`_ may raise ``FileNotFoundError``
if cwd no longer exists. Return an empty string instead.

5.9.4
=====
Expand Down
10 changes: 6 additions & 4 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,20 @@ OpenBSD
::

export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
pkg_add -v python gcc
pkg_add -v python3 gcc
pip install psutil

NetBSD
------

Assuming Python 3.11 (the most recent at the time of writing):

::

export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
export PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
pkg_add -v pkgin
pkgin install python3 gcc
pip install psutil
pkgin install python311-* gcc12-* py311-setuptools-* py311-pip-*
python3.11 -m pip install psutil

Sun Solaris
-----------
Expand Down
42 changes: 34 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ include psutil/arch/aix/ifaddrs.h
include psutil/arch/aix/net_connections.c
include psutil/arch/aix/net_connections.h
include psutil/arch/aix/net_kernel_structs.h
include psutil/arch/bsd/cpu.c
include psutil/arch/bsd/cpu.h
include psutil/arch/bsd/disk.c
include psutil/arch/bsd/disk.h
include psutil/arch/bsd/net.c
include psutil/arch/bsd/net.h
include psutil/arch/bsd/proc.c
include psutil/arch/bsd/proc.h
include psutil/arch/bsd/sys.c
include psutil/arch/bsd/sys.h
include psutil/arch/freebsd/cpu.c
include psutil/arch/freebsd/cpu.h
include psutil/arch/freebsd/disk.c
Expand Down Expand Up @@ -83,8 +93,18 @@ include psutil/arch/openbsd/socks.c
include psutil/arch/openbsd/socks.h
include psutil/arch/osx/cpu.c
include psutil/arch/osx/cpu.h
include psutil/arch/osx/process_info.c
include psutil/arch/osx/process_info.h
include psutil/arch/osx/disk.c
include psutil/arch/osx/disk.h
include psutil/arch/osx/mem.c
include psutil/arch/osx/mem.h
include psutil/arch/osx/net.c
include psutil/arch/osx/net.h
include psutil/arch/osx/proc.c
include psutil/arch/osx/proc.h
include psutil/arch/osx/sensors.c
include psutil/arch/osx/sensors.h
include psutil/arch/osx/sys.c
include psutil/arch/osx/sys.h
include psutil/arch/solaris/environ.c
include psutil/arch/solaris/environ.h
include psutil/arch/solaris/v10/ifaddrs.c
Expand All @@ -98,18 +118,24 @@ include psutil/arch/windows/mem.h
include psutil/arch/windows/net.c
include psutil/arch/windows/net.h
include psutil/arch/windows/ntextapi.h
include psutil/arch/windows/process_handles.c
include psutil/arch/windows/process_handles.h
include psutil/arch/windows/process_info.c
include psutil/arch/windows/process_info.h
include psutil/arch/windows/process_utils.c
include psutil/arch/windows/process_utils.h
include psutil/arch/windows/proc.c
include psutil/arch/windows/proc.h
include psutil/arch/windows/proc_handles.c
include psutil/arch/windows/proc_handles.h
include psutil/arch/windows/proc_info.c
include psutil/arch/windows/proc_info.h
include psutil/arch/windows/proc_utils.c
include psutil/arch/windows/proc_utils.h
include psutil/arch/windows/security.c
include psutil/arch/windows/security.h
include psutil/arch/windows/sensors.c
include psutil/arch/windows/sensors.h
include psutil/arch/windows/services.c
include psutil/arch/windows/services.h
include psutil/arch/windows/socks.c
include psutil/arch/windows/socks.h
include psutil/arch/windows/sys.c
include psutil/arch/windows/sys.h
include psutil/arch/windows/wmi.c
include psutil/arch/windows/wmi.h
include psutil/tests/README.rst
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ build: ## Compile (in parallel) without installing.
@# to allow "import psutil" when using the interactive interpreter from
@# within this directory.
PYTHONWARNINGS=all $(PYTHON) setup.py build_ext -i $(BUILD_OPTS)
$(PYTHON) -c "import psutil" # make sure it actually worked

install: ## Install this package as current user in "edit" mode.
${MAKE} build
Expand Down
14 changes: 9 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| |downloads| |stars| |forks| |contributors| |coverage|
| |version| |py-versions| |packages| |license|
| |github-actions| |appveyor| |doc| |twitter| |tidelift|
| |github-actions-wheels| |github-actions-bsd| |appveyor| |doc| |twitter| |tidelift|
.. |downloads| image:: https://img.shields.io/pypi/dm/psutil.svg
:target: https://pepy.tech/project/psutil
Expand All @@ -18,13 +18,17 @@
:target: https://github.com/giampaolo/psutil/graphs/contributors
:alt: Contributors

.. |github-actions| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/build.yml?label=Linux%2C%20macOS%2C%20FreeBSD%20tests
.. |github-actions-wheels| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/build.yml?label=Linux%2C%20macOS%2C%20Windows
:target: https://github.com/giampaolo/psutil/actions?query=workflow%3Abuild
:alt: Linux, macOS, Windows tests
:alt: Linux, macOS, Windows

.. |appveyor| image:: https://img.shields.io/appveyor/build/giampaolo/psutil/master.svg?maxAge=3600&label=Windows%20tests
.. |github-actions-bsd| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/bsd.yml?label=FreeBSD,%20NetBSD,%20OpenBSD
:target: https://github.com/giampaolo/psutil/actions?query=workflow%3Absd-tests
:alt: FreeBSD, NetBSD, OpenBSD

.. |appveyor| image:: https://img.shields.io/appveyor/build/giampaolo/psutil/master.svg?maxAge=3600&label=Windows%20(py2)
:target: https://ci.appveyor.com/project/giampaolo/psutil
:alt: Windows tests (Appveyor)
:alt: Windows (Appveyor)

.. |coverage| image:: https://coveralls.io/repos/github/giampaolo/psutil/badge.svg?branch=master
:target: https://coveralls.io/github/giampaolo/psutil?branch=master
Expand Down
31 changes: 23 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1180,9 +1180,10 @@ Process class

.. method:: exe()

The process executable as an absolute path.
On some systems this may also be an empty string.
The return value is cached after first call.
The process executable as an absolute path. On some systems, if exe cannot
be determined for some internal reason (e.g. system process or path no
longer exists), this may be an empty string. The return value is cached
after first call.

>>> import psutil
>>> psutil.Process().exe()
Expand Down Expand Up @@ -1281,7 +1282,9 @@ Process class

.. method:: cwd()

The process current working directory as an absolute path.
The process current working directory as an absolute path. If cwd cannot be
determined for some internal reason (e.g. system process or directiory no
longer exists) it may return an empty string.

.. versionchanged:: 5.6.4 added support for NetBSD

Expand Down Expand Up @@ -2599,7 +2602,7 @@ On Windows:
::

set PSUTIL_DEBUG=1 python.exe script.py
psutil-debug [psutil/arch/windows/process_info.c:90]> NtWow64ReadVirtualMemory64(pbi64.PebBaseAddress) -> 998 (Unknown error) (ignored)
psutil-debug [psutil/arch/windows/proc.c:90]> NtWow64ReadVirtualMemory64(pbi64.PebBaseAddress) -> 998 (Unknown error) (ignored)


Security
Expand Down Expand Up @@ -2634,6 +2637,18 @@ Supported Python versions are 2.7, 3.4+ and PyPy3.
Timeline
========

- 2023-04-17:
`5.9.5 <https://pypi.org/project/psutil/5.9.5/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#595>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.9.4...release-5.9.5#files_bucket>`__
- 2022-11-07:
`5.9.4 <https://pypi.org/project/psutil/5.9.4/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#594>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.9.3...release-5.9.4#files_bucket>`__
- 2022-10-18:
`5.9.3 <https://pypi.org/project/psutil/5.9.3/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#593>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.9.2...release-5.9.3#files_bucket>`__
- 2022-09-04:
`5.9.2 <https://pypi.org/project/psutil/5.9.2/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#592>`__ -
Expand All @@ -2650,7 +2665,7 @@ Timeline
`5.8.0 <https://pypi.org/project/psutil/5.8.0/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#580>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.7.3...release-5.8.0#files_bucket>`__
- 2020-10-23:
- 2020-10-24:
`5.7.3 <https://pypi.org/project/psutil/5.7.3/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#573>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.7.2...release-5.7.3#files_bucket>`__
Expand Down Expand Up @@ -2718,7 +2733,7 @@ Timeline
`5.4.6 <https://pypi.org/project/psutil/5.4.6/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#546>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.4.5...release-5.4.6#files_bucket>`__
- 2018-04-14:
- 2018-04-13:
`5.4.5 <https://pypi.org/project/psutil/5.4.5/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#545>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.4.4...release-5.4.5#files_bucket>`__
Expand All @@ -2744,7 +2759,7 @@ Timeline
`diff <https://github.com/giampaolo/psutil/compare/release-5.3.1...release-5.4.0#files_bucket>`__
- 2017-09-10:
`5.3.1 <https://pypi.org/project/psutil/5.3.1/#files>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#530>`__ -
`what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#531>`__ -
`diff <https://github.com/giampaolo/psutil/compare/release-5.3.0...release-5.3.1#files_bucket>`__
- 2017-09-01:
`5.3.0 <https://pypi.org/project/psutil/5.3.0/#files>`__ -
Expand Down
Loading

0 comments on commit 049715e

Please sign in to comment.