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

add gnu gplv3 headers, fix changed license #220

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

backuper - tool for performing scheduled database backups and transferring encrypted data to secure clouds.
Copyright (C) 2023 Rafał Safin
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

Backuper Copyright (C) 2023 Rafał Safin
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
3 changes: 3 additions & 0 deletions backuper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions backuper/backup_targets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions backuper/backup_targets/base_target.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from abc import ABC, abstractmethod
from datetime import UTC, datetime
Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/folder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/mariadb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import hashlib
import logging
import re
Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/mysql.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import hashlib
import logging
import re
Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/postgresql.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import hashlib
import logging
import re
Expand Down
3 changes: 3 additions & 0 deletions backuper/backup_targets/targets_mapping.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from backuper.backup_targets import (
base_target,
file,
Expand Down
3 changes: 3 additions & 0 deletions backuper/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
import logging.config
import socket
Expand Down
3 changes: 3 additions & 0 deletions backuper/core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
import logging.config
import os
Expand Down
3 changes: 3 additions & 0 deletions backuper/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import argparse
import logging
import signal
Expand Down
3 changes: 3 additions & 0 deletions backuper/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions backuper/models/backup_target_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path
from typing import Self

Expand Down
3 changes: 3 additions & 0 deletions backuper/models/models_mapping.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from backuper.config import BackupTargetEnum, UploadProviderEnum
from backuper.models import backup_target_models, upload_provider_models

Expand Down
3 changes: 3 additions & 0 deletions backuper/models/upload_provider_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import base64

from pydantic import BaseModel, SecretStr, field_validator
Expand Down
3 changes: 3 additions & 0 deletions backuper/notifications/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions backuper/notifications/base_notification_system.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from abc import ABC, abstractmethod
from typing import final
Expand Down
3 changes: 3 additions & 0 deletions backuper/notifications/discord.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging

import requests
Expand Down
3 changes: 3 additions & 0 deletions backuper/notifications/notifications_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

"""
https://discord.com/developers/docs/resources/webhook#execute-webhook
"""
Expand Down
3 changes: 3 additions & 0 deletions backuper/notifications/slack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging

import requests
Expand Down
3 changes: 3 additions & 0 deletions backuper/notifications/smtp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
import smtplib
import ssl
Expand Down
3 changes: 3 additions & 0 deletions backuper/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions backuper/tools/compose_db_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pydantic import BaseModel


Expand Down
3 changes: 3 additions & 0 deletions backuper/tools/compose_file_generator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import json
from collections.abc import Callable
from pathlib import Path
Expand Down
3 changes: 3 additions & 0 deletions backuper/tools/endoflife_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import json
from datetime import UTC, datetime
from pathlib import Path
Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)


3 changes: 3 additions & 0 deletions backuper/upload_providers/aws_s3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from pathlib import Path
from typing import Any, TypedDict
Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/azure.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/base_provider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from abc import ABC, abstractmethod
from pathlib import Path
Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/debug.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import logging
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/google_cloud_storage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import base64
import logging
import os
Expand Down
3 changes: 3 additions & 0 deletions backuper/upload_providers/providers_mapping.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from backuper.config import UploadProviderEnum
from backuper.upload_providers import (
aws_s3,
Expand Down
33 changes: 33 additions & 0 deletions scripts/license_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import pathlib
from textwrap import dedent

working_dir = pathlib.Path(__file__).parent.parent.absolute()
license_short_text = dedent(
"""
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
)


def find_python_files(path: pathlib.Path) -> list[pathlib.Path]:
python_file_lst: list[pathlib.Path] = []
for path, dirs, files in path.walk():
for file in files:
if file.endswith(".py"):
python_file_lst.append(path / file)
for dir in dirs:
python_file_lst += find_python_files(path / dir)
return python_file_lst


for python_file in find_python_files(working_dir):
if license_short_text.strip() in python_file.read_text():
continue
print(f"---> {python_file}")
current_file_text = python_file.read_text()
with open(python_file, "w") as file_to_update:
file_to_update.write(license_short_text.strip() + "\n\n" + current_file_text)
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import os
import secrets
from collections.abc import Generator
Expand Down
3 changes: 3 additions & 0 deletions tests/test_backup_target_mariadb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from unittest.mock import Mock

import pytest
Expand Down
3 changes: 3 additions & 0 deletions tests/test_backup_target_mysql.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from unittest.mock import Mock

import pytest
Expand Down
3 changes: 3 additions & 0 deletions tests/test_backup_target_postgresql.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from unittest.mock import Mock

import pytest
Expand Down
3 changes: 3 additions & 0 deletions tests/test_base_backup_target.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from datetime import UTC, datetime
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import os
from pathlib import Path
from unittest.mock import Mock
Expand Down
3 changes: 3 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import sys
from pathlib import Path
from typing import Any, NoReturn
Expand Down
3 changes: 3 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path
from typing import Any

Expand Down
3 changes: 3 additions & 0 deletions tests/test_notifications_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from typing import NoReturn
from unittest.mock import Mock

Expand Down
3 changes: 3 additions & 0 deletions tests/test_notifications_discord.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from typing import Any

import pytest
Expand Down
3 changes: 3 additions & 0 deletions tests/test_notifications_slack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from typing import Any

import pytest
Expand Down
3 changes: 3 additions & 0 deletions tests/test_notifications_smtp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

import smtplib
from unittest.mock import Mock

Expand Down
3 changes: 3 additions & 0 deletions tests/test_storage_provider_aws.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path
from unittest.mock import Mock

Expand Down
3 changes: 3 additions & 0 deletions tests/test_storage_provider_azure.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path
from unittest.mock import Mock

Expand Down
3 changes: 3 additions & 0 deletions tests/test_storage_provider_gcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path
from unittest.mock import Mock

Expand Down
3 changes: 3 additions & 0 deletions tests/test_storage_provider_local.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright: (c) 2024, Rafał Safin <[email protected]>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

from pathlib import Path

import pytest
Expand Down