diff --git a/.dir-locals.el b/.dir-locals.el index 8bccaf0..489230c 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -2,6 +2,17 @@ ; A list of (major-mode . ((var1 . value1) (var2 . value2))) ; Mode can be nil, which gives default values. -((nil . ((indent-tabs-mode . nil) - (c-basic-offset . 4))) -) +; NOTE: If you update this file make sure to update .editorconfig too. + +((c-mode . ((fill-column . 109) + (c-basic-offset . 8) + (eval . (c-set-offset 'substatement-open 0)) + (eval . (c-set-offset 'statement-case-open 0)) + (eval . (c-set-offset 'case-label 0)) + (eval . (c-set-offset 'arglist-intro '++)) + (eval . (c-set-offset 'arglist-close 0)) + (eval . (c-set-offset 'arglist-cont-nonempty '(c-lineup-gcc-asm-reg c-lineup-arglist))))) + (meson-mode . ((meson-indent-basic . 8))) + (nil . ((indent-tabs-mode . nil) + (tab-width . 8) + (fill-column . 79))) ) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..95701d0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.[ch] whitespace=tab-in-indent,trailing-space +*.py whitespace=tab-in-indent,trailing-space diff --git a/Makefile b/Makefile index 9a28097..6d055ca 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + PYTHON = python SED = sed ETAGS = etags diff --git a/docs/conf.py b/docs/conf.py index c4ca874..3329338 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + # -*- coding: utf-8 -*- # # python-systemd documentation build configuration file, created by diff --git a/docs/daemon.rst b/docs/daemon.rst index 0ad11ed..d6065e0 100644 --- a/docs/daemon.rst +++ b/docs/daemon.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: LGPL-2.1-or-later + `systemd.daemon` module ======================= diff --git a/docs/id128.rst b/docs/id128.rst index cd562d5..eb5e876 100644 --- a/docs/id128.rst +++ b/docs/id128.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: LGPL-2.1-or-later + `systemd.id128` module ====================== diff --git a/docs/index.rst b/docs/index.rst index 07b478a..396b4cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ -.. python-systemd documentation master file, created by +.. SPDX-License-Identifier: LGPL-2.1-or-later + +.. python-systemd documentation main file, created by sphinx-quickstart on Sat Feb 9 13:49:42 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. .. _index: diff --git a/docs/journal.rst b/docs/journal.rst index 49c07b1..a5846b7 100644 --- a/docs/journal.rst +++ b/docs/journal.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: LGPL-2.1-or-later + `systemd.journal` module ======================== diff --git a/docs/login.rst b/docs/login.rst index 23204e0..75e5252 100644 --- a/docs/login.rst +++ b/docs/login.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: LGPL-2.1-or-later + `systemd.login` module ======================= diff --git a/meson.build b/meson.build index 22c80da..590f929 100644 --- a/meson.build +++ b/meson.build @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + project( 'python-systemd', 'c', @@ -18,5 +20,4 @@ common_c_args = [ '-DLIBSYSTEMD_VERSION=@0@'.format(libsystemd_dep.version()), ] -subdir('src') - +subdir('src/systemd') diff --git a/pyproject.toml b/pyproject.toml index cec5d80..f80df6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + [project] name = "systemd-python" dynamic = ["version"] diff --git a/src/meson.build b/src/meson.build deleted file mode 100644 index 250e6d6..0000000 --- a/src/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('systemd') diff --git a/src/systemd/.gitattributes b/src/systemd/.gitattributes new file mode 100644 index 0000000..442a3ba --- /dev/null +++ b/src/systemd/.gitattributes @@ -0,0 +1,2 @@ +id128-constants.h generated +id128-defines.h generated diff --git a/src/systemd/__init__.py b/src/systemd/__init__.py index 3b5dbe1..ad529f0 100644 --- a/src/systemd/__init__.py +++ b/src/systemd/__init__.py @@ -1,17 +1,3 @@ -# -*- Mode: python; indent-tabs-mode: nil -*- */ -# +# SPDX-License-Identifier: LGPL-2.1-or-later # # Copyright 2012 David Strauss -# -# python-systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# python-systemd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with python-systemd; If not, see . diff --git a/src/systemd/_daemon.c b/src/systemd/_daemon.c index 8369c0e..add1599 100644 --- a/src/systemd/_daemon.c +++ b/src/systemd/_daemon.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2013-2016 Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #define PY_SSIZE_T_CLEAN diff --git a/src/systemd/_journal.c b/src/systemd/_journal.c index b698996..8820a37 100644 --- a/src/systemd/_journal.c +++ b/src/systemd/_journal.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2012 David Strauss - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #include diff --git a/src/systemd/_reader.c b/src/systemd/_reader.c index 333eb9a..3f642fc 100644 --- a/src/systemd/_reader.c +++ b/src/systemd/_reader.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2013 Steven Hiscocks, Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #define PY_SSIZE_T_CLEAN diff --git a/src/systemd/daemon.py b/src/systemd/daemon.py index 168e55d..178680c 100644 --- a/src/systemd/daemon.py +++ b/src/systemd/daemon.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + from socket import AF_UNSPEC as _AF_UNSPEC from ._daemon import (__version__, diff --git a/src/systemd/id128.c b/src/systemd/id128.c index a887d43..a78d8be 100644 --- a/src/systemd/id128.c +++ b/src/systemd/id128.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2013 Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #include diff --git a/src/systemd/journal.py b/src/systemd/journal.py index 0de5a7f..ac02126 100644 --- a/src/systemd/journal.py +++ b/src/systemd/journal.py @@ -1,24 +1,8 @@ -# -*- Mode: python; coding:utf-8; indent-tabs-mode: nil -*- */ -# +# SPDX-License-Identifier: LGPL-2.1-or-later # # Copyright 2012 David Strauss # Copyright 2012 Zbigniew Jędrzejewski-Szmek # Copyright 2012 Marti Raudsepp -# -# python-systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# python-systemd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with python-systemd; If not, see . - -from __future__ import division import sys as _sys import datetime as _datetime @@ -480,7 +464,6 @@ def stream(identifier=None, priority=LOG_INFO, level_prefix=False): This interface can be used conveniently with the print function: - >>> from __future__ import print_function >>> stream = journal.stream() # doctest: +SKIP >>> print('message...', file=stream) # doctest: +SKIP diff --git a/src/systemd/login.c b/src/systemd/login.c index 5a5bfb9..9f3347e 100644 --- a/src/systemd/login.c +++ b/src/systemd/login.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2013 Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #define PY_SSIZE_T_CLEAN diff --git a/src/systemd/macro.h b/src/systemd/macro.h index 1b0db1d..71ae2db 100644 --- a/src/systemd/macro.h +++ b/src/systemd/macro.h @@ -1,23 +1,9 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /*** - Copyright 2010 Lennart Poettering - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #define DISABLE_WARNING_MISSING_PROTOTYPES \ diff --git a/src/systemd/meson.build b/src/systemd/meson.build index f39f8fb..6a10428 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + # Build _journal extension module python.extension_module( '_journal', @@ -49,7 +51,12 @@ python.extension_module( ) # Install Python modules -python.install_sources('__init__.py', 'journal.py', 'daemon.py', subdir: 'systemd') +python.install_sources( + '__init__.py', + 'journal.py', + 'daemon.py', + subdir: 'systemd', +) # Install test modules python.install_sources( diff --git a/src/systemd/pyutil.c b/src/systemd/pyutil.c index 3526a25..b2a2c36 100644 --- a/src/systemd/pyutil.c +++ b/src/systemd/pyutil.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2013 Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #include diff --git a/src/systemd/pyutil.h b/src/systemd/pyutil.h index e41794d..306e087 100644 --- a/src/systemd/pyutil.h +++ b/src/systemd/pyutil.h @@ -1,23 +1,9 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /*** - Copyright 2013 Zbigniew Jędrzejewski-Szmek - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #ifndef Py_TYPE diff --git a/src/systemd/strv.c b/src/systemd/strv.c index 0ba62a3..f644839 100644 --- a/src/systemd/strv.c +++ b/src/systemd/strv.c @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2010 Lennart Poettering - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #include diff --git a/src/systemd/strv.h b/src/systemd/strv.h index 3ce5505..ce50149 100644 --- a/src/systemd/strv.h +++ b/src/systemd/strv.h @@ -1,21 +1,7 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - Copyright 2010 Lennart Poettering - - python-systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - python-systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with python-systemd; If not, see . ***/ #include "macro.h" diff --git a/src/systemd/test/test_daemon.py b/src/systemd/test/test_daemon.py index 537e9c1..6076f25 100644 --- a/src/systemd/test/test_daemon.py +++ b/src/systemd/test/test_daemon.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + import sys import os import posix diff --git a/src/systemd/test/test_id128.py b/src/systemd/test/test_id128.py index e87b1cc..24da776 100644 --- a/src/systemd/test/test_id128.py +++ b/src/systemd/test/test_id128.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + import contextlib import errno import uuid diff --git a/src/systemd/test/test_journal.py b/src/systemd/test/test_journal.py index dd733cf..8b47990 100644 --- a/src/systemd/test/test_journal.py +++ b/src/systemd/test/test_journal.py @@ -1,4 +1,5 @@ -from __future__ import print_function +# SPDX-License-Identifier: LGPL-2.1-or-later + import contextlib import datetime import errno diff --git a/src/systemd/test/test_login.py b/src/systemd/test/test_login.py index afb5f45..1e92a25 100644 --- a/src/systemd/test/test_login.py +++ b/src/systemd/test/test_login.py @@ -1,4 +1,5 @@ -from __future__ import print_function +# SPDX-License-Identifier: LGPL-2.1-or-later + import select import contextlib import errno diff --git a/src/systemd/util.c b/src/systemd/util.c index a8ca299..b16a20f 100644 --- a/src/systemd/util.c +++ b/src/systemd/util.c @@ -1,20 +1,6 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** - This file is part of systemd. - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . ***/ /* stuff imported from systemd without any changes */ diff --git a/src/systemd/util.h b/src/systemd/util.h index 337920c..2dd7612 100644 --- a/src/systemd/util.h +++ b/src/systemd/util.h @@ -1,22 +1,9 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once /*** - This file is part of systemd. - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . ***/ #include diff --git a/update-constants.py b/update-constants.py index 2dcacda..3a91290 100644 --- a/update-constants.py +++ b/update-constants.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + import sys for file in sys.argv[1:]: