Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
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.12.0
to
0.13.0
+16
-14
PKG-INFO
Metadata-Version: 2.1
Name: pystemd
Version: 0.12.0
Version: 0.13.0
Summary: A systemd binding for python
Home-page: https://github.com/systemd/pystemd
Author: Alvaro Leiva
Author-email: aleivag@meta.com
Author: Alvaro Leiva Geisse
Author-email: Alvaro Leiva Geisse <aleivag@gmail.com>
Maintainer-email: Alvaro Leiva Geisse <aleivag@gmail.com>, Davide Cavalca <dcavalca@meta.com>, Anita Zhang <the.anitazha@gmail.com>
License: LGPL-2.1+
Keywords: systemd
Project-URL: changelog, https://github.com/systemd/pystemd/blob/main/CHANGES.md
Project-URL: homepage, https://github.com/systemd/pystemd
Project-URL: repository, https://github.com/systemd/pystemd.git
Keywords: systemd,linux,dbus
Classifier: Operating System :: POSIX :: Linux

@@ -23,2 +26,4 @@ Classifier: Intended Audience :: Developers

Description-Content-Type: text/markdown
Provides-Extra: t
Provides-Extra: lint
License-File: LICENSE

@@ -42,3 +47,3 @@

In software as in screenwriting, its better to show how things work instead of
In software as in screenwriting, it's better to show how things work instead of
tell. So this is how you would use the library from a interactive shell.

@@ -51,4 +56,5 @@

Note: you need to call `unit.load()` because by default `Unit` will not load the
unit information as that would require do some IO. You can auto load the unit by
`Unit(b'postfix.service', _autoload=True)`
unit information as that would require do some IO (and we dont like doing io on a class constructor).
You can autoload the unit by `Unit(b'postfix.service', _autoload=True)` or using the unit as a
contextmanager like `with Unit(b'postfix.service'): ...`

@@ -276,10 +282,6 @@ Once the unit is loaded, you can interact with it, you can do by accessing its

if you want to install from source then after you clone this repo you need to
if you want to install from source then after you clone this repo all you need to do its `pip install . `
```bash
$ pip install -r requirements.txt # get six
$ python3 setup.py install # only python3 supported
```
but in addition to previous requirements you'll need:
In addition to previous requirements you'll need:

@@ -286,0 +288,0 @@ * setuptools: Just use your distro's package (e.g. python-setuptools).

@@ -0,1 +1,51 @@

[build-system]
requires = ["setuptools>=46.4.0", "wheel", "cython"]
build-backend = "setuptools.build_meta"
[project]
name = "pystemd"
version = "0.13.0"
readme = "README.md"
description="A systemd binding for python"
dependencies = [
"lxml",
"psutil"
]
authors = [{name = "Alvaro Leiva Geisse", email = "aleivag@gmail.com"}]
maintainers = [
{name = "Alvaro Leiva Geisse", email = "aleivag@gmail.com"},
{name = "Davide Cavalca", email = "dcavalca@meta.com"},
{name = "Anita Zhang", email = "the.anitazha@gmail.com"}
]
classifiers = [
"Operating System :: POSIX :: Linux",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
]
license = { text = "LGPL-2.1+" }
keywords = ["systemd", "linux", "dbus"]
[project.optional-dependencies]
# Used for runing tests
t = ["pytest", "pytest-cov"]
lint = [
"black",
"mypi",
"isort",
]
[project.urls]
changelog = "https://github.com/systemd/pystemd/blob/main/CHANGES.md"
homepage = "https://github.com/systemd/pystemd"
repository = "https://github.com/systemd/pystemd.git"
[tool.mypy]

@@ -2,0 +52,0 @@ strict = false

Metadata-Version: 2.1
Name: pystemd
Version: 0.12.0
Version: 0.13.0
Summary: A systemd binding for python
Home-page: https://github.com/systemd/pystemd
Author: Alvaro Leiva
Author-email: aleivag@meta.com
Author: Alvaro Leiva Geisse
Author-email: Alvaro Leiva Geisse <aleivag@gmail.com>
Maintainer-email: Alvaro Leiva Geisse <aleivag@gmail.com>, Davide Cavalca <dcavalca@meta.com>, Anita Zhang <the.anitazha@gmail.com>
License: LGPL-2.1+
Keywords: systemd
Project-URL: changelog, https://github.com/systemd/pystemd/blob/main/CHANGES.md
Project-URL: homepage, https://github.com/systemd/pystemd
Project-URL: repository, https://github.com/systemd/pystemd.git
Keywords: systemd,linux,dbus
Classifier: Operating System :: POSIX :: Linux

@@ -23,2 +26,4 @@ Classifier: Intended Audience :: Developers

Description-Content-Type: text/markdown
Provides-Extra: t
Provides-Extra: lint
License-File: LICENSE

@@ -42,3 +47,3 @@

In software as in screenwriting, its better to show how things work instead of
In software as in screenwriting, it's better to show how things work instead of
tell. So this is how you would use the library from a interactive shell.

@@ -51,4 +56,5 @@

Note: you need to call `unit.load()` because by default `Unit` will not load the
unit information as that would require do some IO. You can auto load the unit by
`Unit(b'postfix.service', _autoload=True)`
unit information as that would require do some IO (and we dont like doing io on a class constructor).
You can autoload the unit by `Unit(b'postfix.service', _autoload=True)` or using the unit as a
contextmanager like `with Unit(b'postfix.service'): ...`

@@ -276,10 +282,6 @@ Once the unit is loaded, you can interact with it, you can do by accessing its

if you want to install from source then after you clone this repo you need to
if you want to install from source then after you clone this repo all you need to do its `pip install . `
```bash
$ pip install -r requirements.txt # get six
$ python3 setup.py install # only python3 supported
```
but in addition to previous requirements you'll need:
In addition to previous requirements you'll need:

@@ -286,0 +288,0 @@ * setuptools: Just use your distro's package (e.g. python-setuptools).

lxml
psutil
[lint]
black
mypi
isort
[t]
pytest
pytest-cov

@@ -8,11 +8,7 @@ LICENSE

pystemd/__init__.py
pystemd/__init__.pyi
pystemd/__version__.py
pystemd/base.py
pystemd/base.pyi
pystemd/cutils.c
pystemd/cutils.pyi
pystemd/cutils.pyx
pystemd/daemon.c
pystemd/daemon.pyi
pystemd/daemon.pyx

@@ -24,3 +20,2 @@ pystemd/dbusc.pxd

pystemd/dbuslib.c
pystemd/dbuslib.pyi
pystemd/dbuslib.pyx

@@ -27,0 +22,0 @@ pystemd/exceptions.py

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

# latest release.
__version__ = "0.12.0"
__version__ = "0.13.0"
sys.modules[__name__] = __version__ # type: ignore

@@ -166,3 +166,2 @@ #

b"ConfigurationDirectory": b"as",
b"JoinsNamespaceOf": b"as",
b"PrivateDevices": b"b",

@@ -188,2 +187,4 @@ b"PrivateIPC": b"b",

b"Restart": b"s",
b"RestartUSec": b"t",
b"RestartSec": lambda _, value: (b"RestartUSec", b"t", int(value * 10**6)),
# Limits

@@ -325,2 +326,51 @@ b"LimitCPU": b"t",

b"GID": b"u",
b"Id": b"s",
b"Names": b"as",
b"Following": b"s",
b"Upholds": b"as",
b"UpheldBy": b"as",
b"OnSuccess": b"as",
b"OnSuccessOf": b"as",
b"OnFailureOf": b"as",
b"PropagatesStopTo": b"as",
b"StopPropagatedFrom": b"as",
b"SliceOf": b"as",
b"AccessSELinuxContext": b"s",
b"LoadState": b"s",
b"ActiveState": b"s",
b"FreezerState": b"s",
b"SubState": b"s",
b"FragmentPath": b"s",
b"DropInPaths": b"as",
b"UnitFileState": b"s",
b"UnitFilePreset": b"s",
b"CanStart": b"b",
b"CanStop": b"b",
b"CanReload": b"b",
b"CanIsolate": b"b",
b"CanClean": b"as",
b"CanFreeze": b"b",
b"OnSuccesJobMode": b"s",
b"OnSuccessJobMode": b"s",
b"NeedDaemonReload": b"b",
b"Markers": b"as",
b"JobTimeoutUSec": b"t",
b"JobRunningTimeoutUSec": b"t",
b"ConditionResult": b"b",
b"AssertResult": b"b",
b"Transient": b"b",
b"Perpetual": b"b",
b"StartLimitIntervalUSec": b"t",
b"StartLimitBurst": b"u",
b"StartLimitAction": b"s",
b"FailureActionExitStatus": b"i",
b"SuccessActionExitStatus": b"i",
b"InvocationID": b"ay",
b"Refs": b"as",
b"RequiresOverridable": b"as",
b"RequisiteOverridable": b"as",
b"RequiredByOverridable": b"as",
b"RequisiteOfOverridable": b"as",
b"StartLimitInterval": b"t",
b"StartLimitIntervalSec": b"t",
# Extra

@@ -327,0 +377,0 @@ b"_custom": lambda _, value: value,

@@ -17,3 +17,3 @@ pystemd

In software as in screenwriting, its better to show how things work instead of
In software as in screenwriting, it's better to show how things work instead of
tell. So this is how you would use the library from a interactive shell.

@@ -26,4 +26,5 @@

Note: you need to call `unit.load()` because by default `Unit` will not load the
unit information as that would require do some IO. You can auto load the unit by
`Unit(b'postfix.service', _autoload=True)`
unit information as that would require do some IO (and we dont like doing io on a class constructor).
You can autoload the unit by `Unit(b'postfix.service', _autoload=True)` or using the unit as a
contextmanager like `with Unit(b'postfix.service'): ...`

@@ -251,10 +252,6 @@ Once the unit is loaded, you can interact with it, you can do by accessing its

if you want to install from source then after you clone this repo you need to
if you want to install from source then after you clone this repo all you need to do its `pip install . `
```bash
$ pip install -r requirements.txt # get six
$ python3 setup.py install # only python3 supported
```
but in addition to previous requirements you'll need:
In addition to previous requirements you'll need:

@@ -261,0 +258,0 @@ * setuptools: Just use your distro's package (e.g. python-setuptools).

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

import ast
import glob

@@ -40,21 +39,2 @@ import subprocess

THIS_DIR = Path(__file__).parent
with (THIS_DIR / "README.md").open() as f:
long_description = f.read()
# get and compute the version string
version_file = THIS_DIR / "pystemd" / "__version__.py"
with version_file.open() as f:
parsed_file = ast.parse(f.read())
__version__ = [
expr.value.s
for expr in parsed_file.body
if isinstance(expr, ast.Assign)
and isinstance(expr.targets[0], ast.Name)
and isinstance(expr.value, ast.Str)
and expr.targets[0].id == "__version__"
][0]
# Use C extensions if respective files are present. Else let Cython modules be

@@ -85,40 +65,15 @@ # compiled to C code. The latter is the case when using a clone of the git

package_data = []
package_data.extend(glob.glob("pystemd/*.pyi"))
package_data.extend(glob.glob("pystemd/*/*.pyi"))
setup(
name="pystemd",
version=__version__,
version="0.13.0",
author="Alvaro Leiva Geisse",
author_email="aleivag@gmail.com",
packages=["pystemd", "pystemd.systemd1", "pystemd.machine1", "pystemd.DBus"],
author="Alvaro Leiva",
author_email="aleivag@meta.com",
ext_modules=external_modules,
url="https://github.com/systemd/pystemd",
classifiers=[
"Operating System :: POSIX :: Linux",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
],
keywords=["systemd"],
description="A systemd binding for python",
package_data={
"pystemd": [str(Path(p).relative_to("pystemd")) for p in package_data]
"pystemd": [
str(Path(p).relative_to("pystemd")) for p in glob.glob("pystemd/**/*.pyi")
]
},
install_requires=[
"lxml",
"psutil",
],
long_description=long_description,
long_description_content_type="text/markdown",
license="LGPL-2.1+",
)

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

from lxml import etree
from pystemd.base import SDObject

@@ -16,0 +17,0 @@

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

import os
import unittest

@@ -10,0 +9,0 @@ from unittest.mock import MagicMock, Mock, patch

#
# Copyright (c) 2021-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
#
from typing import Any
from pystemd import DBus, __version__, machine1, systemd1
SDUnit = systemd1.Unit
SDManager = systemd1.Manager
SDMachine = machine1.Machine
def run(
cmd: Any,
address=...,
service_type=...,
name=...,
user=...,
user_mode=...,
nice=...,
runtime_max_sec=...,
env=...,
extra=...,
cwd=...,
machine=...,
wait=False,
remain_after_exit=False,
collect=False,
raise_on_fail=False,
pty=...,
pty_master=...,
pty_path=...,
stdin=...,
stdout=...,
stderr=...,
_wait_polling=...,
slice_=...,
stop_cmd=...,
stop_post_cmd=...,
start_pre_cmd=...,
start_post_cmd=...,
): ...
#
# Copyright (c) 2020-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
#
import re
from contextlib import contextmanager
from typing import Any, AnyStr, Iterator, Optional
from xml.dom.minidom import Element
from pystemd.dbuslib import DBus, apply_signature
from pystemd.utils import x2char_star
class SDObject(object):
def __init__(
self,
destination: AnyStr,
path: AnyStr,
bus=Optional[DBus],
_autoload: bool = False,
) -> None: ...
def __enter__(self) -> SDObject: ...
@contextmanager
def bus_context(self) -> Iterator[DBus]: ...
def get_introspect_xml(self) -> Element: ...
def load(self, force: bool = False) -> None: ...
class SDInterface(object):
def __init__(self, sd_object: SDObject, interface_name: AnyStr) -> None: ...
def __repr__(self) -> str: ...
def _get_property(self, property_name: str) -> Any: ...
def _set_property(self, property_name: AnyStr, value: Any) -> None: ...
def setns(fd: int, nstype: int) -> int: ...
# Copyright (c) 2020-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
#
from typing import Union
LISTEN_FDS_START: int
class PystemdDaemonError(Exception):
pass
def listen_fds(unset_environment: bool) -> int: ...
def notify(unset_environment: bool, *args: str, **kwargs: Union[int, str]) -> None: ...
def booted() -> bool: ...
def watchdog_enabled(unset_environment: bool) -> int: ...
# Copyright (c) 2020-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
#
from typing import Any, Dict, List, Tuple
class DbusMessage:
body: Any
headers: Dict[str, Any]
def process_reply(self, with_headers: bool): ...
def is_empty(self) -> bool: ...
def is_signal(self, interface: bytes, member: bytes) -> bool: ...
class DBus:
user_mode: bool
def __init__(self, user_mode: bool = False) -> None: ...
def __enter__(self) -> "DBus": ...
def __exit__(self, *errs) -> None: ...
def open(self) -> None: ...
def close(self) -> None: ...
def process(self) -> DbusMessage: ...
def call_method(
self,
destination: bytes,
path: bytes,
interface: bytes,
method: bytes,
args: Any,
) -> Any: ...
def get_property(
self,
destination: bytes,
path: bytes,
interface: bytes,
property: bytes,
rtype: bytes,
) -> Any: ...
def match_signal(
self, sender, path, interface, member, callback, userdata=None
) -> None: ...
def wait(self, timeout: int) -> None: ...
def get_fd(self) -> int: ...
def get_allow_interactive_authorization(self) -> bool: ...
def set_allow_interactive_authorization(self, interactive: bool) -> None: ...
class DBusMachine(DBus):
def __init__(self, machine: bytes) -> None: ...
class DBusRemote(DBus):
def __init__(self, host: bytes) -> None: ...
class DBusAddress(DBus):
def __init__(self, address: bytes, peer_to_peer: bool) -> None: ...
def apply_signature(signature: bytes, values: List[Any]) -> list[Tuple[int, Any]]: ...
def path_encode(prefix: bytes, external_id: bytes) -> bytes: ...
def path_decode(path: bytes, prefix: bytes) -> bytes: ...