You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

pystemd

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pystemd - pypi Package Compare versions

Comparing version
0.13.2
to
0.13.4
+25
tests/test_version.py
from pathlib import Path
import toml
from cstq import Query
def test_version():
"""all version should be the same"""
root = Path(__file__).parent.parent
pyproject = root / "pyproject.toml"
setup = root / "setup.py"
version = root / "pystemd/__version__.py"
setup_version = (
Query(setup)
.find_function_call(func_name="setup")
.extended_node()
.keyword_args["version"]
.literal_eval()
)
version_version = (
Query(version).find_assignment("__version__").value.literal_eval_for_node()
)
pyproject_version = toml.loads(pyproject.read_text())["project"]["version"]
assert setup_version == version_version == pyproject_version
+1
-1
Metadata-Version: 2.1
Name: pystemd
Version: 0.13.2
Version: 0.13.4
Summary: A systemd binding for python

@@ -5,0 +5,0 @@ Author: Alvaro Leiva Geisse

@@ -7,3 +7,3 @@ [build-system]

name = "pystemd"
version = "0.13.2"
version = "0.13.4"
readme = "README.md"

@@ -40,3 +40,8 @@ description="A systemd binding for python"

# Used for runing tests
t = ["pytest", "pytest-cov"]
t = [
"pytest",
"pytest-cov",
# cstq and toml are used for testing version
"cstq", "toml"
]
lint = [

@@ -43,0 +48,0 @@ "black",

Metadata-Version: 2.1
Name: pystemd
Version: 0.13.2
Version: 0.13.4
Summary: A systemd binding for python

@@ -5,0 +5,0 @@ Author: Alvaro Leiva Geisse

@@ -12,1 +12,3 @@ lxml

pytest-cov
cstq
toml

@@ -5,3 +5,2 @@ LICENSE

pyproject.toml
setup.cfg
setup.py

@@ -54,2 +53,3 @@ pystemd/__init__.py

tests/test_unit_signatures.py
tests/test_utils.py
tests/test_utils.py
tests/test_version.py

@@ -13,4 +13,4 @@ #

# latest release.
__version__ = "0.13.2"
__version__ = "0.13.4"
sys.modules[__name__] = __version__ # type: ignore

@@ -569,4 +569,13 @@ # cython: language_level=3

cdef class DBusRemote(DBus):
"DBus class that connects to a remote host"
"""
DBus class that connects to a remote host, this is using ssh,
this uses [sd_bus_open_system_remote](https://manpages.debian.org/testing/libsystemd-dev/sd_bus_open_system_remote.3.en.html)
that will:
connects to the system bus on the specified host using ssh(1). host consists of an optional user name followed by the "@" symbol,
and the hostname, optionally followed by a ":" and a port, optionally followed by a "/" and a machine name. If the machine name is
given, a connection is created to the system bus in the specified container on the remote machine, and otherwise a connection to
the system bus on the specified host is created.
"""
cdef char* host

@@ -578,3 +587,3 @@

cdef int open_dbus_bus(self):
return dbusc.sd_bus_open_system_remote(&(self.bus), self.remote)
return dbusc.sd_bus_open_system_remote(&(self.bus), self.host)

@@ -581,0 +590,0 @@ cdef class DBusAddress(DBus):

@@ -26,5 +26,7 @@ import os

main_process: Sequence[str] = (),
user_mode: bool = False,
) -> None:
self.unit: Optional[pystemd.systemd1.Unit] = None
self.properties = properties
self.user_mode = user_mode
self.main_process_cmd = main_process or [

@@ -41,3 +43,3 @@ "/bin/bash",

self.main_process_cmd,
user_mode=False,
user_mode=self.user_mode,
extra={

@@ -124,4 +126,5 @@ **self.properties,

def __init__(self, *, properties=None, **kwargs) -> None:
def __init__(self, *, properties=None, user_mode=False, **kwargs) -> None:
super().__init__(**kwargs)
self.user_mode = user_mode
self.properties = {

@@ -134,2 +137,3 @@ pystemd.utils.x2char_star(k): v for k, v in (properties or {}).items()

properties=self.properties,
user_mode=self.user_mode,
main_process=[

@@ -152,4 +156,6 @@ "/bin/bash",

def __init__(self, properties, **kwargs):
self.pool_transient_unit_context = TransientUnitContext(properties)
def __init__(self, properties, user_mode: bool = False, **kwargs):
self.pool_transient_unit_context = TransientUnitContext(
properties, user_mode=user_mode
)
super().__init__(**{**kwargs, "mp_context": self.pool_transient_unit_context})

@@ -168,8 +174,10 @@

def run(fnc, properties, *args, **kwargs):
def run(fnc, properties, *args, _user_mode: bool = False, **kwargs):
"""
Simple helper to call a method in a single worker
"""
with TransientUnitPoolExecutor(properties=properties or {}, max_workers=1) as poold:
with TransientUnitPoolExecutor(
properties=properties or {}, max_workers=1, user_mode=_user_mode
) as poold:
future = poold.submit(fnc, *args, **kwargs)
return future.result()

@@ -213,8 +213,8 @@ #

b"StandardInputFileDescriptor": get_fno(stdin) if stdin else stdin,
b"StandardOutputFileDescriptor": get_fno(stdout)
if stdout
else stdout,
b"StandardErrorFileDescriptor": get_fno(stderr)
if stderr
else stderr,
b"StandardOutputFileDescriptor": (
get_fno(stdout) if stdout else stdout
),
b"StandardErrorFileDescriptor": (
get_fno(stderr) if stderr else stderr
),
}

@@ -221,0 +221,0 @@ )

@@ -1,4 +0,1 @@

[metadata]
license_file = LICENSE
[egg_info]

@@ -5,0 +2,0 @@ tag_build =

@@ -66,3 +66,3 @@ #!/usr/bin/env python3

name="pystemd",
version="0.13.2",
version="0.13.4",
author="Alvaro Leiva Geisse",

@@ -69,0 +69,0 @@ author_email="aleivag@gmail.com",

@@ -23,3 +23,3 @@ #!/usr/bin/env fbpython

TransientUnitPoolExecutor.assert_called_once_with(
properties=properties, max_workers=1
properties=properties, max_workers=1, user_mode=False
)

@@ -35,3 +35,3 @@ poold.submit.assert_called_once_with(function, kwargs="kwarg")

with pystemd.futures.TransientUnitPoolExecutor(properties):
TransientUnitContext.assert_called_once_with(properties)
TransientUnitContext.assert_called_once_with(properties, user_mode=False)
context.start_unit.assert_called_once()

@@ -83,2 +83,3 @@ context.stop_unit.assert_called_once()

properties=properties,
user_mode=False,
main_process=[

@@ -85,0 +86,0 @@ "/bin/bash",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display