PK!Ū'cc.meltan/create.toml[config] repo1 = { device = "device1", backupType = "bt1", configDir = "cd1" } repo2 = { device = "device2", backupType = "bt2", configDir = "cd2" } [hash] repo1 = { device = "device1", backupType = "bt1", configDir = "cd1" } repo2 = { device = "device2", backupType = "bt2", configDir = "cd2" } [ignore] repo1 = { device = "device1", configDir = "cd1" } repo2 = { device = "device2", configDir = "cd2" } [include] repo1 = { device = "device1", configDir = "cd1" } repo2 = { device = "device2", configDir = "cd2" } [logging] configDir = [ "cd1", "cd2" ] [temp] configDir = [ "cd1", "cd2" ] PK!~B$$.meltan/device.repo.borg# Required options are marked with a "!REQUIRED!" comment at the top; entire categories can be required. # All Windows paths must use double slashes, or must use single quotes instead of double quotes when using single slashes. # All paths must be absolute, use a tilde, or an environment variable # !REQUIRED! [backup] # Repository, List of sources (parent directories), and bind mount paths. repo.dir = "" # repo.dir = "C:\\r" repo.bind = "" # repo.bind = "/c/r" source.dir = [] # source.dir = ["/t1", "/t2", 'C:\t1', 'C:\t2', "C:\\t3", "C:\\t4"] source.bind = [] # source.bind = ["/t1", "/t2", "/c1", "/c2", "/c3", "/c4"] # The check type; can be: # "hash:[check type]:[0 or 1]"; the 0 or 1 notifies the check mechanism of whether to follow symbolic link (1) or not (0), while the "check type" can be one of, in order of speed: # imohash # xxhash # "fd:[positive integer]:[0 or 1]" (no negatives or decimals); the "fd / find" method is used. The positive integer refers to "changed within however many minutes", so 120 minutes for 2 hours, for example; the 0 or 1 notifies the check mechanism of whether to follow symbolic link (1) or not (0). # The check types are mapped to the index of the sources, so "check1" will map to "source1", "check2" to "source2", and so on. # If you don't want to check the source(s) for changes, pass meltan or melmetal the "--noCheck" option, which will run the command regardless, whether it be for backing up, pruning, or otherwise. checks = [] # checks = ["fd:60:0"] # Used for the docker volumes; can be either read-write ("rw") or read-only ("ro"). Just as the checks, the modes are mapped to the index of the sources. modes = [] # modes = ["rw"] encrypted = 0 # encrypted = 0 # !REQUIRED! [config] # Configuration Directory, i.e. the directory this file is in; defaults to "~/.meltan" on Unix Sysems and "C:\\Users\\user\\.meltan" on Windows. ANY ENVIRONMENT VARIABLES USED HERE WILL COME FROM THE CURRENT SHELL INSTANCE. dir = "" # dir = "C:\\Users\\user\\.meltan" bind = "" # bind = "~/.meltan" timezone = "" # timezone = "Canada/Eastern" [environment] # Any environmental variables to be used, following the format "var_name = var_val"; these can also be used to store directories for the repository, source[s], etc. N1 = "V1" N2 = "V2" N3 = "V3" [exclusions] # List of exclusion patterns; the glob patterns are used to create the ".fdignore" file. All the exclusion patterns are used to create the ".borgignore" file. glob = [] # glob = ["*.md", "*.jpg"] regEx = [] # regEx = ["", ""] fnMatch = [] # fnMatch = [] pathPrefix = [] # pathPrefix = [] pathFullMatch = [] # pathFullMatch = [] [otherDirs] # List of other directories, such as ssh, rc, shared repos, etc. cache.dir = "" # cache.dir = "~/.cache/borg" cache.bind = "" # cache.bind = "~/.cache/borg" tmp.dir = "" # tmp.dir = "C:\\Users\\user\\tmp" tmp.bind = "" # tmp.bind = "/c/tmp" base.dir = "" # base.dir = "" base.bind = "" # base.bind = "" config.dir = "" # config.dir = "" config.bind = "" # config.bind = "" security.dir = "" # security.dir = "" security.bind = "" # security.bind = "" Keys.dir = "" # Keys.dir = "" Keys.bind = "" # Keys.bind = "" debugProfile.dir = "" # debugProfile.dir = "" debugProfile.bind = "" # debugProfile.bind = "" [arguments.create] # The options and arguments; the value represents either the value of the option, or a "1" for True, and a "0" for False if they are boolean options or arguments stats = 0 # stats = 0 json = 0 # json = 0 progress = 0 # progress = 0 excludeCaches = 0 # excludeCaches = 0 keepTagFiles = 0 # keepTagFiles = 0 oneFileSystem = 0 # oneFileSystem = 0 numericOwner = 0 # numericOwner = 0 noATime = 0 # noATime = 0 noCTime = 0 # noCTime = 0 noBirthTime = 0 # noBirthTime = 0 noBSDFlags = 0 # noBSDFlags = 0 ignoreInode = 0 # ignoreInode = 0 noCacheSync = 0 # noCacheSync = 0 noFilesCache = 0 # noFilesCache = 0 readSpecial = 0 # readSpecial = 0 critical = 0 # critical = 0 error = 0 # error = 0 warning = 0 # warning = 0 info = 0 # info = 0 debug = 0 # debug = 0 logJSON = 0 # logJSON = 0 showVersion = 0 # showVersion = 0 showRC = 0 # showRC = 0 considerPartFiles = 0 # considerPartFiles = 0 compression = "" # compression = "auto,zstd,22" chunkerParameters = "" # chunkerParameters = "10,23,16,10" excludeIfPresent = "" # excludeIfPresent = "ignore.tag" filter = "" # filter = "" filesCache = "" # filesCache = "" checkpointInterval = "" # checkpointInterval = "" lockWait = "" # lockWait = "" umask = "" # umask = "" remoteRateLimit = "" # remoteRateLimit = "" debugProfileFile = "" # debugProfileFile = "filename" (not with path, but with extension) [arguments.create.vars] BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK = "no" BORG_RELOCATED_REPO_ACCESS_IS_OK = "no" BORG_HOSTNAME_IS_UNIQUE = "yes" BORG_HOST_ID = "" BORG_LOGGING_CONF = "" BORG_RSH = "" BORG_REMOTE_PATH = "" BORG_FILES_CACHE_TTL = "" BORG_SHOW_SYSINFO = "" BORG_KEY_FILE = "" [arguments.prune] [arguments.prune.vars] [arguments.show] [arguments.show.vars] PK![FE.meltan/device.repo.git# All Windows paths must use double slashes, or must use single quotes instead of double quotes when using single slashes. [backup] # Repository, List of sources (parent directories), and bind mount paths; windows paths must use double forward slashes. # NOTE: DO NOT SET A BIND PATH OF "/root/" or "~"; if a git ignore exists in the source directory, it will be modified! repo.dir = "" # repo.dir = "C:\\r" repo.bind = "" # repo.bind = "/c/r" source.dir = "" # source.dir = "C:\\s" source.bind = "" # source.bind = "/c/s" # The check type; can be "hash or git"; if the format "f:[positive integer]" is used (no negatives or decimals), the "fd / find" method is used (changed within however many minutes, so 120 minutes for 2 hours, for example). # If you don't want to check the source(s) for changes, pass meltan or melmetal the "--noCheck" option, which will run the command regardless, whether it be for backing up, pruning, or otherwise. checks = "git" # checks = "git" # Used for the docker volumes; can be either read-write ("rw") or read-only ("ro"). modes = "" # modes = "rw" [config] # Configuration Directory, i.e. the directory this file is in dir = "" # dir = "C:\\Users\\user\\.meltan" bind = "" # bind = "/c/.meltan" [environment] vars.names = [] # vars.names = ["N1", "N2", "N3"] vars.vals = [] # vars.vals = ["V1", "V2", "V3"] [exclusions] # List of glob / regex patterns; the glob patterns are used to create the ".fdignore" file, while both are used to create the ".hgignore" file. glob = [] # glob = ["*.md", "*.jpg"] regex = [] # regex = ["", ""] [otherDirs] # List of other directories, such as ssh, rc, shared repos, etc. # GitRc directory; looks for the mercurial config file in the source directory first. rc.dir = "" # rc.dir = "C:\\rc" rc.bind = "" # rc.bind = "/c/rc" ssh.dir = "" # ssh.dir = "C:\\.ssh" ssh.bind = "" # ssh.bind = "/c/.ssh" [arguments.push] # The options and arguments; the value represents either the value of the option, or a "1" for True, and a "0" for False if they are boolean options or arguments addremove = 1 # addremove = 1 message = 1 # message = 1 # The name is the message PK!`G G .meltan/device.repo.hg# All Windows paths must use double slashes, or must use single quotes instead of double quotes when using single slashes. [backup] # Repository, List of sources (parent directories), and bind mount paths; windows paths must use double forward slashes. # NOTE: DO NOT SET A BIND PATH OF "/root/" or "~"; if a mercurial ignore exists in the source directory, it will be modified! repo.dir = "" # repo.dir = "C:\\r" repo.bind = "" # repo.bind = "/c/r" source.dir = "" # source.dir = "C:\\s" source.bind = "" # source.bind = "/c/s" # The check type; can be "hash or hg"; if the format "f:[positive integer]" is used (no negatives or decimals), the "fd / find" method is used (changed within however many minutes, so 120 minutes for 2 hours, for example). # If you don't want to check the source(s) for changes, pass meltan or melmetal the "--noCheck" option, which will run the command regardless, whether it be for backing up, pruning, or otherwise. checks = "hg" # checks = "hg" # Used for the docker volumes; can be either read-write ("rw") or read-only ("ro"). modes = "" # modes = "rw" [config] # Configuration Directory, i.e. the directory this file is in dir = "" # dir = "C:\\Users\\user\\.meltan" bind = "" # bind = "/c/.meltan" [environment] vars.names = [] # vars.names = ["N1", "N2", "N3"] vars.vals = [] # vars.vals = ["V1", "V2", "V3"] [exclusions] # List of glob / regex patterns; the glob patterns are used to create the ".fdignore" file, while both are used to create the ".hgignore" file. glob = [] # glob = ["*.md", "*.jpg"] regex = [] # regex = ["", ""] [otherDirs] # List of other directories, such as ssh, rc, shared repos, etc. # HgRc directory; looks for the mercurial config file in the source directory first. # rc.dir = "" rc.dir = "C:\\rc" # rc.bind = "" rc.bind = "/c/rc" # ssh.dir = "" ssh.dir = "C:\\.ssh" # ssh.bind = "" ssh.bind = "/c/.ssh" # shared.dir = [] shared.dir = ["C:\\shared1", "", "C:\\shared3"] # These line up with the sources; for example: if the sources at index 1 and 3 have mercurial shared directories, then index 1 and 3 here will have the shared directory; since source 2 does not have a shared directory, it's index value will be blank (a pair of quotes). # shared.bind = [] shared.bind = ["/c/shared1", "", "/c/shared3"] # Same rules as above. [arguments.push] # The options and arguments; the value represents either the value of the option, or a "1" for True, and a "0" for False if they are boolean options or arguments addremove = 1 # addremove = 1 message = 1 # message = 1 # The name is the message PK!]?.meltan/group.toml[device1] repo1 = { backup_type = "", argument = "", name = "", checkpoint = 0, monthly = 0, config_dir = "", no_check = 0, in_docker = 0, use_docker = 0, no_debug = 0, dry_run = 0, tag = ""} repo2 = { backup_type = "", argument = "", name = "", checkpoint = 0, monthly = 0, config_dir = "", no_check = 0, in_docker = 0, use_docker = 0, no_debug = 0, dry_run = 0, tag = ""} [device2] repo1 = { backup_type = "", argument = "", name = "", checkpoint = 0, monthly = 0, config_dir = "", no_check = 0, in_docker = 0, use_docker = 0, no_debug = 0, dry_run = 0, tag = ""} repo2 = { backup_type = "", argument = "", name = "", checkpoint = 0, monthly = 0, config_dir = "", no_check = 0, in_docker = 0, use_docker = 0, no_debug = 0, dry_run = 0, tag = ""} PK!֤j~n~n command.py# Personal Note: Program runs twice despite not changing any files is due to python cache files of the program updating in my source directory # Imports import click import docker import nanotech as nt import struct # From Imports from addict import Dict as D from dataclasses import field from io import TextIOWrapper from loguru import logger from os import environ, path as osPath, name as osName from pydantic.dataclasses import dataclass from sarge import capture_both from sys import exit from toml import load from tqdm import tqdm from typing import Dict, List, Any, Callable, Union, Tuple # Local Imports import mm from type_classes.borg import borg class Error(Exception): pass class dockerError(Error): pass class noBackupArgument(Error): pass class noCheckType(Error): pass class noLogFile(Error): pass class shrug(Error): pass dfd: Callable[..., Any] = field(default_factory=dict) dfl: Callable[..., Any] = field(default_factory=list) enum: Callable[..., Tuple[Any]] = enumerate ls: Callable[..., Any] = logger.success li: Callable[..., Any] = logger.info le: Callable[..., Any] = logger.error fullpath: Callable[..., str] = nt.nanite().fullpath # Alias the function runner decorators zoom: Callable[..., Any] = nt.decorators.zoom savitar: Callable[..., Any] = nt.decorators.savitar godspeed: Callable[..., Any] = nt.decorators.godspeed @dataclass class data: configDir: str = "" configFile: Dict[str, Any] = dfd device: str = "" repoName: str = "" backupType: str = "" noCheck: bool = False inDocker: bool = False useDocker: bool = False encrypted: bool = False name: str = "" argument: str = "" command: str = "" repo: str = "" sources: Union[str, Tuple[str]] = "" exclGlob: List[str] = dfl exclRegEx: List[str] = dfl checks: List[str] = dfl modes: List[str] = dfl hashFileNames: List[str] = dfl hashFilePaths: List[Tuple[str]] = dfl changedList: List[bool] = dfl envVars: Dict[str, str] = dfd envVarList: List[str] = dfl dirList: List[str] = dfl bindList: List[str] = dfl volumes: Dict[str, Dict[str, str]] = dfd logTime: str = "" includeFileNames: List[str] = dfl dryRun: bool = False arch: bool = True if struct.calcsize( "P" ) * 8 == 64 else False allReturnCodes: List[int] = dfl hold: Any = "" noDebug: bool = False logFile: str = "" subcommand: str = "cmd" tag: str = "" @dataclass class checks: fd: bool = False hg: bool = False git: bool = False hash: List[str] = dfl @dataclass class exclusions: glob: List[str] = dfl regEx: List[str] = dfl fn: List[str] = dfl pp: List[str] = dfl pf: List[str] = dfl backupTypeList: List[str] = ["borg"] @click.command( name="cmd", cls=nt.naniteComm, no_args_is_help=True ) @click.option( "-d", "--device", required=True, help="the source device" ) @click.option( "-r", "--repo-name", required=True, help="the name of the backup repository", ) # Update when new backup type is added @click.option( "-b", "--backup-type", required=True, type=click.Choice(backupTypeList), help='the backup type; can be one of "hg, borg, git, rs, zb, zp, zs, "', ) @click.option( "-a", "--argument", required=True, help='the argument to run with the backup type, such as "borg create, borg prune, etc."', ) @click.option( "-n", "--name", cls=nt.naniteOp, xor=["checkpoint", "monthly"], default="daily", help="set the name of the backup", ) @click.option( "-c", "--checkpoint", cls=nt.naniteOp, xor=["name", "monthly"], is_flag=True, type=bool, help="create checkpoint backup", ) @click.option( "-m", "--monthly", cls=nt.naniteOp, xor=["name", "checkpoint"], is_flag=True, type=bool, help="create monthly backup", ) @click.option( "--config-dir", default=environ.get("MM_CONFIG_DIR", "") if environ.get("MM_CONFIG_DIR", "") else "default", type=click.Path(), help='the config directory for the repo; defaults to "~/.meltan" under Unix systems and "C:\\Users\\[user]\\.meltan" under Windows', ) @click.option( "-N", "--no-check", is_flag=True, type=bool, help="run the command without checking the sources for changes", ) @click.option( "--in-docker", is_flag=True, type=bool, help="this is running in a docker container", ) @click.option( "--use-docker", is_flag=True, type=bool, help="use a docker-based programs", ) @click.option( "--no-debug", is_flag=True, type=bool, help="prevent logging from being output to the terminal", ) @click.option( "--dry-run", is_flag=True, type=bool, help='run the commands without actually doing anything; applies the "--no-check" option automatically.', ) @click.option( "--tag", cls=nt.naniteOp, req_all_of=["in_docker"], default="latest", help='kept for use when running "meltan mmd"', ) @logger.catch def command( device, repo_name, backup_type, argument, name, checkpoint, monthly, config_dir, no_check, in_docker, use_docker, no_debug, dry_run, tag, ): """ Run the commands, whether backup, pruning, etc. """ if osName == "nt": le( mm.colorize( "red", 'Sorry; it seems as though you are running the "meltan cmd" subcommand on Windows; please use the "meltan mmd" subcommand instead.', ) ) exit(1) d: type = data() @mm.logUpOrDown(d) def logBase(d): """ Set up logging """ d.noDebug = no_debug checkForDocker = capture_both("cat /proc/1/cgroup") cfdReturnCodes: List[int] = checkForDocker.returncodes if not all(cfdReturnCodes): d.inDocker = ( in_docker if in_docker else any( [ "docker" in _.split("/") for _ in tqdm(TextIOWrapper(checkForDocker.stdout)) ] ) ) else: d.inDocker = in_docker if config_dir == "default": _config_dir: Union[str, None] = environ.get( "CONFIGDIR", None ) if _config_dir: d.configDir = mm.setConfigDir(_config_dir) else: d.configDir = mm.setConfigDir("default") else: d.configDir = mm.setConfigDir(config_dir) ls( mm.colorize("green", "configDir set:\n\n") + mm.colorize("pink", d.configDir) + "\n" ) li( mm.colorize("blue", "Using Docker Melmetal Image") if d.inDocker else mm.colorize( "blue", "Not Using Docker Melmetal Image" ) ) givenOptions: str = f"""{mm.colorize("blue", "Given Options:")} {mm.colorize("blue", "Device:")} {mm.colorize("pink", device)} {mm.colorize("blue", "Repository:")} {mm.colorize("pink", repo_name)} {mm.colorize("blue", "Backup Type:")} {mm.colorize("pink", backup_type)} {mm.colorize("blue", "Argument:")} {mm.colorize("pink", argument)} {mm.colorize("blue", "Name:")} {mm.colorize("pink", name)} {mm.colorize("blue", "Checkpoint:")} {mm.colorize("pink", bool(checkpoint))} {mm.colorize("blue", "Monthly:")} {mm.colorize("pink", bool(monthly))} {mm.colorize("blue", "Configuration Directory:")} {mm.colorize("pink", config_dir)} {mm.colorize("blue", "Do Not Check:")} {mm.colorize("pink", bool(no_check))} {mm.colorize("blue", "In Docker Image:")} {mm.colorize("pink", bool(in_docker))} {mm.colorize("blue", "Use Docker Image:")} {mm.colorize("pink", bool(use_docker))} {mm.colorize("blue", "Do Not Show Logging")} {mm.colorize("pink", bool(no_debug))} {mm.colorize("blue", "Dry Run")} {mm.colorize("pink", bool(dry_run))} """ li(givenOptions) c: type = checks() excl: type = exclusions() u: str = "shadowrylander" d.tag = tag images: Dict[str, str] = D( {"borg": f"{u}/mm_borgbackup:{d.tag}"} ) @zoom() def assignments(): @zoom() def assignClicks(): d.device = device d.repoName = repo_name d.backupType = backup_type if environ.get("CONFIGFILE", None): d.configFile = D(load(environ["CONFIGFILE"])) else: d.configFile = mm.setConfigFile( d.configDir, d.device, d.repoName, d.backupType, ) ls( mm.colorize("green", "configFile loaded:\n\n") + mm.colorize( "pink", f"{d.configDir}/{d.device}/{d.repoName}.{d.backupType}", ) + "\n" ) # When in "dry run" mode, checks will repeatedly come up true if file or directories # have been created, modified, or deleted, and false otherwise, due to any applicable # hash files not being updated. d.dryRun = dry_run if d.dryRun: ls( mm.colorize( "blue", "Running command without actually running command.", ) ) d.envVars = d.configFile.environment for k, v in tqdm(d.envVars.items()): environ[k] = v ls( mm.colorize( "green", "Set preliminary environment variables necessary for creating the directory-based lists.", ) ) d.useDocker = ( True if in_docker or use_docker else False ) li( mm.colorize("blue", "Using Docker Backup Image ") + mm.colorize("pink", images[d.backupType]) if d.useDocker else mm.colorize( "blue", "Not Using Docker Backup Images" ) ) d.noCheck = no_check li( mm.colorize("blue", "Skipping Checks") if d.noCheck else mm.colorize("blue", "Running Checks") ) d.name = mm.setName( name, checkpoint, monthly, d.inDocker ) ls( mm.colorize("green", "Name set to: ") + mm.colorize("pink", d.name) ) d.argument = argument ls( mm.colorize( "green", "Assigned click options to data class variables.", ) ) @savitar() def onCMD(): d.repo = fullpath(d.configFile.backup.repo.dir) d.sources = list(map(fullpath, d.configFile.backup.source.dir)) @savitar() def inDocker(): d.repo = fullpath(d.configFile.backup.repo.bind) d.sources = list(map(fullpath, d.configFile.backup.source.bind)) inDocker() if d.inDocker else onCMD() ls( mm.colorize( "green", "Assigned variables necessary for running the program in a docker container.", ) if d.inDocker else mm.colorize( "green", "Assigned variables necessary for running the program on the command line.", ) ) d.encrypted = bool(d.configFile.backup.encrypted) d.checks = d.configFile.backup.checks # The last two "read-writes" are for the repo and the config directories respectively d.modes = ( d.configFile.backup.modes + ["rw" for dir in d.configFile.otherDirs] + ["rw", "rw"] ) d.hashFileNames = list(nt.joins(d.sources).pathName()) ls( mm.colorize( "green", "Created list of dir.subdir names" ) ) d.hashFilePaths = [ mm.hashFilePath( d.configDir, d.device, d.repoName, i ) for i in tqdm(d.hashFileNames) ] ls( mm.colorize( "green", "Created list of hash file paths" ) ) # Note to self: this copies the reference to the list, not the list itself; to copy the list values into a new list, use newList = oldList[:] d.includeFileNames = d.hashFileNames @zoom() def assignExcl(): """ Assign Exclusions """ ce: Dict[ str, Union[List[str], str] ] = d.configFile.exclusions excl.glob = ce.glob excl.regEx = ce.regEx excl.fn = ce.fnMatch excl.pp = ce.pathPrefix excl.pf = ce.pathFullMatch ls( mm.colorize( "green", "Assigned exclusions to the exclusion class variables.", ) ) @godspeed( gs_noCheck=d.noCheck, gs_if="not gs_noCheck", gs_else="pass", ) def assignCheckTypes(): """ Assign existing check types """ d.changedList = [] if d.backupType == "hg": c.hg = True if d.backupType == "git": c.git = True for check in tqdm(d.checks): _: List[str] = check.split(":") if "hash" in _: c.hash.append(_[1]) ls( mm.colorize("green", "hash check type ") + mm.colorize("pink", _[1]) + mm.colorize("green", " confirmed") ) for check in tqdm(d.checks): if "fd" in check.split(":"): c.fd = True ls( mm.colorize( "green", "fd check type confirmed" ) ) if d.noCheck: li( mm.colorize( "blue", "Did not need to assign check types to the check types class variables.", ) ) else: ls( mm.colorize( "green", "Assigned check types to the check types class variables.", ) ) if d.useDocker: ls( mm.colorize( "green", "Set environment variables necessary for the docker backup images.", ) ) else: ls( mm.colorize( "green", "Set environment variables necessary for command line use.", ) ) def SNToFloat(sn) -> int: base, power = sn.split("e+") return round(float(base + ("0" * int(power)))) # The fd check requires the followSymlinks argument, but the hash check uses the include file, which was generated using the followSymlinks argument def checkers() -> bool: for index, check in tqdm(enum(d.checks)): cs: List[str] = check.split(":") if check == "hg": return nt.checks( d.sources[index], d.hashFilePaths[index][2], d.dryRun ).vc("hg") elif check == "git": return nt.checks( d.sources[index], d.hashFilePaths[index][3], d.dryRun ).git("git") elif "hash" in cs: """ This gets the tuple of hash file paths, then the exact file path, using False as index 0, and True as index 1, as the 32-bit hash file path is at index 0, and the 64-bit hash file path is at index 1. """ return nt.checks( d.sources[index], d.hashFilePaths[index][d.arch], d.dryRun, ).hash( cs[1], f"{d.configDir}/{d.device}/{d.repoName}/include/{d.includeFileNames[index]}", SNToFloat("8.389e+6"), d.arch, ) elif "fd" in cs: return nt.checks(d.sources[index]).fd( cs[1], f"{d.configDir}/{d.device}/{d.repoName}/ignore/.fdignore", cs[2], ) else: le( mm.colorize("red", "Check type ") + mm.colorize("pink", check) + mm.colorize("red", " does not exist.\n\n") ) raise noCheckType() return False # Run whichever is necessary given the checks class, i.e. "c.hg", "c.fd", etc. , # and the backupType, such as "borg", "" @zoom() def createIgnores() -> None: ignore: type = nt.ignores(excl.glob, excl.regEx) if c.hg: ignore.hg(source[0]) if c.fd or c.hash: ignore.fd( f"{d.configDir}/{d.device}/{d.repoName}/ignore/.fdignore" ) if c.git: ignore.git(source[0], excl.fn) if d.backupType == "borg": ignore.borg( f"{d.configDir}/{d.device}/{d.repoName}/ignore/.borgignore", excl.fn, excl.pp, excl.pf, ) ls(mm.colorize("green", "Created the ignore files.")) # NOTE: The "hash" check type uses an "include" file generated from the "exclude" file @godspeed( gs_hash=bool(c.hash), gs_noCheck=d.noCheck, gs_if="gs_hash and not gs_noCheck", gs_else="pass", ) def createInclude() -> None: for index, source in tqdm(enum(d.sources)): check: List[str] = d.checks[index].split(":") if "hash" in check: nt.etc.genInclFile( excl.glob, source, f"{d.configDir}/{d.device}/{d.repoName}/include/{d.includeFileNames[index]}", bool(check[2]), ) if c.hash and not d.noCheck: ls( mm.colorize( "green", "Created the fd-hash include files." ) ) else: li( mm.colorize( "blue", "Did not require the fd-hash include files.", ) ) # Exit before running anything else if not d.noCheck and not checkers(): li( mm.colorize( "blue", "Nothing has changed! Exiting now." ) ) exit(0) @zoom(excl) def createCommand(excl) -> None: bt = d.backupType a = d.argument try: exec(f"{bt}.{a}(d, excl).returnCMD()") ls( mm.colorize("green", "Created Command:\n\n") + mm.colorize("pink", d.command) + "\n" ) except AttributeError: le( mm.colorize("red", "Sorry; no argument ") + mm.colorize("pink", a) + mm.colorize("red", "!") ) raise noBackupArgument() except Exception as e: le( mm.colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + mm.colorize("pink", e) ) raise shrug() # Environmental Variables @zoom(excl) def setBackupEnvVars(excl) -> None: bt = d.backupType a = d.argument try: exec(f"{bt}.{a}(d, excl).setEnvVars()") except AttributeError: le( mm.colorize("red", "Sorry; no argument ") + mm.colorize("pink", a) + mm.colorize("red", "!") ) raise noBackupArgument() except Exception as e: le( mm.colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + mm.colorize("pink", e) ) raise shrug() if d.useDocker: git = ( list(createGITEnvList(nt.etc().GITInfo())) if c.git else [] ) d.envVarList = [ f"{k}={v}" for k, v in tqdm(d.envVars.items()) ] + git else: for k, v in tqdm(d.envVars.items()): if k not in environ: environ[k] = v @godspeed( gs_useDocker=d.useDocker, gs_if="gs_useDocker", gs_else="pass", ) def createVolumes(): # Creating Lists sourceBinds: List[str] = list(map(fullpath, d.configFile.backup.source.bind)) repoBind: List[str] = [fullpath(d.configFile.backup.repo.bind)] _bind: str = d.configFile.config.bind configBind: List[str] = [ mm.setConfigDir("default" if not _bind else _bind) ] otherBinds: List[str] = [] cfod: Dict[str, str] = d.configFile.otherDirs for bind in tqdm(cfod.items()): otherBinds.append(bind[1]["bind"]) d.bindList: List[str] = [ bind for bind in tqdm( ( sourceBinds + otherBinds + repoBind # Required for exclusion files + configBind ) ) if bind ] ls( mm.colorize( "green", "Created list of directory binds" ) ) if d.inDocker: d.dirList = d.bindList else: otherDirs: List[str] = [] for directory in tqdm(cfod.items()): otherDirs.extend([directory[1]["dir"]]) d.dirList = [ directory for directory in tqdm( ( d.sources + otherDirs + [d.repo] # Required for exclusion files + [d.configDir] ) ) if directory ] ls( mm.colorize( "green", "Created list of directories" ) ) # Creating Volumes d.volumes: Dict[str, Dict[str, str]] = D( { directory: {"bind": "", "mode": ""} for directory in tqdm(d.dirList) } ) for index, directory in tqdm(enum(d.dirList)): d.volumes[directory].bind = d.bindList[index] d.volumes[directory].mode = d.modes[index] ls( mm.colorize( "green", "Mapped the directories to their binds and modes.", ) ) ls( mm.colorize( "green", "Created the necessary volume mappings for the docker module.", ) ) @zoom() def main(): # Create Endgame def runEndgame(excl) -> None: bt = d.backupType a = d.argument try: exec(f"{bt}.{a}(d, excl).endgame()") except AttributeError: le( mm.colorize("red", "Sorry; no argument ") + mm.colorize("pink", a) + mm.colorize("red", "!") ) raise noBackupArgument() except Exception as e: le( mm.colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + mm.colorize("pink", e) ) raise shrug() if d.noCheck: ls( mm.colorize("green", "No checks run due to ") + mm.colorize("pink", f"noCheck = {d.noCheck}") ) else: ls( mm.colorize( "green", "Checked all sources for created, modified, or deleted files and / or directories.", ) ) if d.useDocker: # Instantiate and connect to the default docker socket # or your environment configuration client = docker.from_env() ls( mm.colorize( "green", "Instantiated and connected to the default docker socket / environment configuration.", ) ) try: container = client.containers.run( images[d.backupType], [d.command], environment=d.envVarList, detach=True, volumes=d.volumes, ) # {'Error': None, 'StatusCode': 1} d.allReturnCodes.append(int(bool(container.wait()["Error"]))) container.remove() runEndgame(excl) ls( mm.colorize("green", "Command\n\n") + mm.colorize("pink", f'"{d.command}"') + mm.colorize( "green", "\n\n\t\trun on docker image " ) + mm.colorize("pink", images[d.backupType]) + mm.colorize("green", ".") ) return int(any(d.allReturnCodes)) except docker.errors.ContainerError as e: @mm.logUpOrDown(d, True) def inner(d): pass le( mm.colorize("red", "Container ") + mm.colorize("pink", images[d.backupType]) + mm.colorize("red", " threw an error:\n\n") + mm.colorize( "pink", "\n".join( [ line for part in tqdm(str(e).split("\n")) ] ), ) ) raise dockerError() except Exception as e: @mm.logUpOrDown(d, True) def inner(d): pass le( mm.colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + mm.colorize("pink", e) ) raise shrug() else: cmdOutput = capture_both(d.command) d.hold = cmdOutput.returncodes d.allReturnCodes.extend(d.hold) if any(d.hold): le( mm.colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + mm.colorize("pink", "\n".join([line.rstrip() for line in TextIOWrapper(cmdOutput.stderr)])) ) raise shrug() else: ls( mm.colorize("green", "Command\n\n") + mm.colorize("pink", d.command) + mm.colorize( "green", "\n\n\t\trun on command line." ) ) runEndgame(excl) return int(any(d.allReturnCodes)) PK!oICC create.py# Imports import click import nanotech as nt # From Imports from dataclasses import field from loguru import logger from os import ( name as osName, makedirs, path as osPath, sep as osSep, ) from pydantic.dataclasses import dataclass from tqdm import tqdm from typing import Callable, Any, List # Local Imports import mm zoom: Callable[..., Any] = nt.decorators.zoom godspeed: Callable[..., Any] = nt.decorators.godspeed fullpath: Callable[..., str] = nt.nanite().fullpath ls: Callable[..., Any] = logger.success li: Callable[..., Any] = logger.info lw: Callable[..., Any] = logger.warning le: Callable[..., Any] = logger.error dfl: Callable[..., Any] = field(default_factory=list) # Define error classes class Error(Exception): pass class somethingElseHappened(Error): pass class noLogFile(Error): pass @dataclass class data: inDocker: bool = False logTime: str = "" logFile: str = "" noDebug: bool = False allReturnCodes: List[int] = dfl configDir: str = "" subcommand: str = "create" clickBase: List[str] = [ "device", "repo_name", "backup_type", "config_dir", ] clickObjects: List[str] = [ "hash", "config", "ignore", "logging", "include", "temp", "all", ] @click.command( name="create", cls=nt.naniteComm, no_args_is_help=True ) @click.option( "-d", "--device", cls=nt.naniteOp, xor=["create_file"], req_all_of=[_ for _ in tqdm(clickBase) if _ != "config_dir"], help="the source device", ) @click.option( "-r", "--repo-name", cls=nt.naniteOp, xor=["create_file"], req_all_of=[_ for _ in tqdm(clickBase) if _ != "config_dir"], help="the name of the backup repository", ) @click.option( "-b", "--backup-type", cls=nt.naniteOp, xor=["create_file"], req_all_of=[_ for _ in tqdm(clickBase) if _ != "config_dir"], help='the backup type; can be one of "hg, borg, git, rs, zb, zp, zs, "', ) @click.option( "-c", "--config-dir", cls=nt.naniteOp, xor=["create_file"], req_all_of=clickBase, type=click.Path(), default="default", help='the config directory for the repo; defaults to "~/.meltan" under Unix systems and "C:\\Users\\[user]\\.meltan" under Windows', ) @click.option( "--create-file", cls=nt.naniteOp, xor=clickBase, nargs=2, help="a TOML file with the list of creation options", ) @click.option( "-c", "--config", cls=nt.naniteOp, one_req=clickObjects, req_one_of=["create_file"] + clickBase, is_flag=True, help="create the config files", ) @click.option( "-m", "--hash", cls=nt.naniteOp, one_req=clickObjects, req_one_of=["create_file"] + clickBase, is_flag=True, help="create the hash files and directories, the latter of which is set beneath the config directory", ) @click.option( "--ignore", cls=nt.naniteOp, one_req=clickObjects, req_one_of=["create_file"] + clickBase, is_flag=True, help="create the ignores folder under the configuration folder", ) @click.option( "--include", cls=nt.naniteOp, one_req=clickObjects, req_one_of=["create_file"] + clickBase, is_flag=True, help="create the includes folder under the configuration folder", ) @click.option( "--logging", cls=nt.naniteOp, one_req=clickObjects, is_flag=True, help="create the logging folder under the configuration folder", ) @click.option( "--temp", cls=nt.naniteOp, one_req=clickObjects, is_flag=True, help="create the temporary folder under the configuration folder", ) @click.option( "--all", cls=nt.naniteOp, one_req=clickObjects, req_one_of=["create_file"] + clickBase, is_flag=True, help="run all creation commands; use if using this program for the first time!", ) @click.option( "--no-debug", is_flag=True, type=bool, help="prevent logging from being output to the terminal", ) @logger.catch def create( device, repo_name, backup_type, config_dir, create_file, hash, config, ignore, logging, include, temp, all, no_debug, ): d: type = data() @mm.logUpOrDown(d) def logBase(d): """ Set up logging """ d.noDebug = no_debug d.configDir = ( mm.setConfigDir(create_file[0]) if create_file else mm.setConfigDir(config_dir) ) ls( mm.colorize( "green", "Configuration / Create Directory Set:\n\n", ) + mm.colorize("pink", config_dir) + "\n" ) if create_file: createList: Dict[str, Any] = D(load(fullpath(*create_file))) ls( mm.colorize("green", "createList loaded:\n\n") + mm.colorize( "pink", fullpath(*create_file) ) + "\n" ) def createDir(createItem, directory): try: makedirs(directory) ls( mm.colorize("green", "Created directory\n\n") + mm.colorize("pink", directory) + "\n" ) except FileExistsError: lw( "\n\n" + mm.colorize("pink", directory) + mm.colorize( "yellow", "\n\n\t\talready exists! Please wait while we attempt to create the ", ) + mm.colorize("pink", createItem) + mm.colorize("yellow", " not exist yet!") ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() def createConfig(device, repoName, backupType, configDir): createDir("config file if it does", configDir) try: _: str = fullpath( configDir, device, f"{repoName}.{backupType}" ) ls( mm.colorize( "green", "Configuration File Set:\n\n" ) + mm.colorize("pink", _) + "\n" ) with open(_, "x") as file: with open( # osPath.join(".meltan", "device.repo." + backupType), fullpath(".meltan", "device.repo." + backupType, currentDir = 2), "r", ) as template: for line in tqdm(template): file.write(line) ls( mm.colorize( "green", "Configuration File Created:\n\n" ) + mm.colorize("pink", _) + "\n" ) except FileExistsError: lw( mm.colorize( "yellow", "Sorry; configuration file\n\n" ) + mm.colorize("pink", _) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() if config or all: createConfig(device, repo_name, backup_type, config_dir) elif create_file: cc: Dict[str, List[str]] = createList.config ls( mm.colorize( "green", "Create List Configuration File Data Loaded!", ) ) for repo, dct in tqdm(cc.items()): createConfig( dct["device"], repo, dct["backupType"], mm.setConfigDir(dct["configDir"]), ) ls( mm.colorize( "green", "Create List Configuration Files Created!", ) ) def createHash(device, repoName, backupType, configDir): configFile: Dict[str, Any] = mm.setConfigFile( configDir, device, repoName, backupType ) backupSourceDirs: List[ str ] = configFile.backup.source.dir backupSourceBinds: List[ str ] = configFile.backup.source.bind fileNames: List[str] = list( nt.joins( backupSourceDirs + backupSourceBinds ).pathName() ) ls( mm.colorize( "green", 'Created hash file names following the "dir.subdir" format.', ) ) createDir( "hash files if they do", fullpath(configDir, device, repoName, "hash"), ) def inner(hash: str): try: open(hash, "x").close() ls( mm.colorize( "green", "Hash File Created:\n\n" ) + mm.colorize("pink", hash) + "\n" ) except FileExistsError: lw( mm.colorize("yellow", "Sorry; hash file\n\n") + mm.colorize("pink", hash) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() for name in tqdm(fileNames): # Tuple Unpacking paths: Tuple[str] = mm.hashFilePath( configDir, device, repoName, name ) for path in paths: inner(path) if hash or all: createHash(device, repo_name, backup_type, config_dir) elif create_file: ch: Dict[str, List[str]] = createList.hash ls( mm.colorize( "green", "Create List Hash File Data Loaded!" ) ) for repo, dct in tqdm(ch.items()): createHash( dct["device"], repo, dct["backupType"], mm.setConfigDir(dct["configDir"]), ) ls( mm.colorize( "green", "Create List Hash Files Created!" ) ) def createIgnore(configDir, device, repoName): directory = fullpath(configDir, device, repoName, "ignore") try: makedirs(directory) ls( mm.colorize( "green", "Ignore Directory Created:\n\n" ) + mm.colorize("pink", directory) + "\n" ) except FileExistsError: lw( mm.colorize( "yellow", "Sorry; ignore directory\n\n" ) + mm.colorize("pink", directory) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() if ignore or all: createIgnore(config_dir, device, repo_name) elif create_file: ci: Dict[str, List[str]] = createList.ignore ls( mm.colorize( "green", "Create List Ignore File Data Loaded!" ) ) for repo, dct in tqdm(ci.items()): createIgnore( mm.setConfigDir(dct["configDir"]), dct["device"], repo, ) ls( mm.colorize( "green", "Create List Ignore Files Created!" ) ) def createInclude(configDir, device, repoName): directory = fullpath(configDir, device, repoName, "include") try: makedirs(directory) ls( mm.colorize( "green", "Include Directory Created:\n\n" ) + mm.colorize("pink", directory) + "\n" ) except FileExistsError: lw( mm.colorize( "yellow", "Sorry; include directory\n\n" ) + mm.colorize("pink", directory) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() if include or all: createInclude(config_dir, device, repo_name) elif create_file: ci: Dict[str, List[str]] = createList.include ls( mm.colorize( "green", "Create List Include File Data Loaded!" ) ) for repo, dct in tqdm(ci.items()): createInclude( mm.setConfigDir(dct["configDir"]), dct["device"], repo, ) ls( mm.colorize( "green", "Create List Include Files Created!" ) ) # Convert to using the if statement def createLogging(configDir): _: str = fullpath(configDir, "logs") dirs = ( f"{_}{osSep}{ignDir}" for ignDir in tqdm( ("cmd", "create", "meltan", "mmd", "backup") ) ) for directory in tqdm(dirs): try: makedirs(directory) ls( mm.colorize( "green", "Logging Directory Created:\n\n" ) + mm.colorize("pink", directory) + "\n" ) except FileExistsError: lw( mm.colorize( "yellow", "Sorry; logging directory\n\n" ) + mm.colorize("pink", directory) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() if logging or all: createLogging(config_dir) elif create_file: cl: List[str] = createList.logging.configDir ls( mm.colorize( "green", "Create List Logging Directory Data Loaded!", ) ) for directory in tqdm(cl): createLogging(mm.setConfigDir(directory)) ls( mm.colorize( "green", "Create List Logging Directories Created!", ) ) # Use the if statement def createTemp(configDir): directory: str = fullpath(configDir, "tmp") try: makedirs(directory) ls( mm.colorize( "green", "Temporary Directory Created:\n\n" ) + mm.colorize("pink", directory) + "\n" ) except FileExistsError: lw( mm.colorize( "yellow", "Sorry; temporary directory\n\n" ) + mm.colorize("pink", directory) + mm.colorize( "yellow", "\n\n\t\talready exists!" ) ) except Exception as e: le( mm.colorize( "red", "Something happened! This was the error:\n\n", ) + mm.colorize("pink", e) + "\n" ) raise somethingElseHappened() if temp or all: createTemp(config_dir) elif create_file: cl: List[str] = createList.temp.configDir ls( mm.colorize( "green", "Create List Temporary Directory Data Loaded!", ) ) for directory in tqdm(cl): createTemp(mm.setConfigDir(directory)) ls( mm.colorize( "green", "Create List Temporary Directories Created!", ) ) PK! Tuple[str]: hashFiles: Tuple[str] = ("32", "64", "hg", "git") return [fullpath(configDir, device, repo, "hash", f"{pathName}.h{_}") for _ in hashFiles] # Create a list of environmental GIT variable values def createGITEnvList( GITList: List[str] ) -> Generator[str, None, None]: for _ in zip( ( "GIT_AUTHOR_NAME=", "GIT_AUTHOR_EMAIL=", "GIT_COMMITTER_NAME=", "GIT_COMMITTER_EMAIL=", ), GITList, ): yield "".join(_) # Set configuration directory def setConfigDir(configDir: str) -> str: if configDir == "default": return fullpath("~", ".meltan") else: return fullpath(configDir) # Load TOML Backup Config File def setConfigFile( configDir: str, device: str, repoName: str, backupType: str ) -> Dict[str, Any]: _configDir: str = setConfigDir(configDir) configFile: str = fullpath(_configDir, device, f"{repoName}.{backupType}") return D(load(configFile)) def continuum(inDocker: bool): return datetime.now(pytz.timezone(environ["TIMEZONE"])) if inDocker else datetime.now() # Return the names for backups def setName( name: str, checkpoint: bool, monthly: bool, inDocker: bool ) -> str: # Instantiate the current local date and time dt = continuum(inDocker) if ( (checkpoint and name != "daily") or (monthly and name != "daily") or (checkpoint and monthly) ): raise noCombo( 'Sorry, using any combination of "name", "monthly", and "checkpoint" is not permitted.' ) elif monthly: # Sets name to the year and month name return f'{dt.strftime("%B.%Y")}' elif checkpoint: # Sets name to "checkpoint" plus # "year.month.day.hour.minute.second", all numeric return f'checkpoint.{dt.strftime("%Y.%m.%d.%H.%M.%S")}' elif name == "daily": # Sets name to "year.month.day.hour.minute.second", all numeric return f'{dt.strftime("%Y.%m.%d.%H.%M.%S")}' else: # Sets name to the name variable passed in, # plus the years, month, and day, all numeric return f'{name}.{dt.strftime("%Y.%m.%d.%H.%M.%S")}' def setResetLogs(self) -> None: def wrapper(func: Callable[..., Any]): previousSubcommand: str = self.d.subcommand previousLogTime: str = self.d.logTime self.d.subcommand = "backup" @logUpOrDown(self.d) def inner(d): pass returnValue = func(self) self.d.subcommand = previousSubcommand self.d.logTime = previousLogTime @logUpOrDown(self.d, True) def inner(d): pass return returnValue return wrapper def logUpOrDown(d, skipLogTime: bool = False) -> None: """ Set up logging """ def wrapper(func: Callable[..., Any]): func(d) if not skipLogTime: # Instantiate the current local date and time dt = continuum(d.inDocker) d.logTime = dt.strftime("%Y.%m.%d.%H.%M.%S") d.logFile: str = fullpath(d.configDir, "logs", d.subcommand, d.logTime + ".log") if d.noDebug: logger.remove() logger.add( d.logFile, rotation="2 months", ) ls( colorize("green", "Log directory set:\n\n") + colorize("pink", d.configDir) + "\n" ) if osPath.isfile(d.logFile): d.allReturnCodes.append(0) ls( colorize("green", "Log File Created:\n\n") + colorize( "pink", d.logFile, ) + "\n" ) else: raise noLogFile(f'Sorry! Log file "{d.logFile}" was not created!') return wrapper colors: Dict[str, Callable[..., Any]] = { "red": fg.red, "green": fg.green, "blue": fg.blue, "yellow": fg.yellow, "pink": fg(*htr("#f69")), } colorize: Callable[..., str] = ( lambda color, string: f"{colors[color]}{string}{fg.rs}" ) PK!XOOpull.py# Imports import click import docker # From Imports from loguru import logger from nanotech import naniteComm from tqdm import tqdm # Local Imports from mm import colorize # Define error classes class Error(Exception): pass class somethingElseHappened(Error): pass class noImage(Error): pass @click.command(name="pull", cls=naniteComm, no_args_is_help=True) @click.argument("programs", nargs=-1) @logger.catch def pull(programs): """ This will pull the meltan docker backup program images from the docker hub, from the "shadowrylander" repository; input a list of backup programs you wish to download, or, use "-d" / "--melmetal" to download the melmetal backup image itself! """ ls: Callable[..., Any] = logger.success le: Callable[..., Any] = logger.error li: Callable[..., Any] = logger.info client = docker.from_env() for program in tqdm(programs): image: str = "shadowrylander/melmetal" if "melmetal" in program.split( ":" ) else f"shadowrylander/mm_{program}" li( colorize("blue", "Image Set: ") + colorize("pink", image) ) if len(program.split(":")) > 1: tag: str = program.split(":")[1] else: tag: str = "latest" li(colorize("blue", "Tag Set: ") + colorize("pink", tag)) try: client.images.pull(image, tag) ls( colorize("green", "Pulled Image: ") + colorize("pink", image) ) except ImageNotFound: le( colorize("red", "Sorry; image ") + colorize("pink", image) + colorize("red", " not found!") ) raise noImage() except Exception as e: le( colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + colorize("pink", e) ) raise somethingElseHappened() PK!type_classes/__init__.pyPK!RE77type_classes/borg/borg.py# Imports import docker # From Imports from addict import Dict as D from io import TextIOWrapper from loguru import logger from nanotech import decorators from os import environ from sarge import capture_both from typing import Dict, List, Any, Union, Callable, Tuple # Local Imports from mm import setConfigDir, colorize, setResetLogs class Error(Exception): pass class shrug(Error): pass class dockerError(Error): pass enum: Callable[..., Tuple[Any]] = enumerate zoom: Callable[..., Any] = decorators.zoom ls: Callable[..., Any] = logger.success li: Callable[..., Any] = logger.info le: Callable[..., Any] = logger.error class create: def __init__(self, d: type, excl: type): self.d: type = d self.excl: type = excl self.create: Dict[str, Any] = D( d.configFile.arguments.create ) ls(colorize("green", "Create dictionary options loaded")) self.commands: Dict[str, str] = D({}) def setEnvVars(self): _envVars: Dict[str, str] = D(self.create.vars) _envVars.BORG_CACHE_DIR = ( self.d.configFile.otherDirs.cache.bind if self.d.inDocker else self.d.configFile.otherDirs.cache.dir ) _envVars.TMPDIR = ( self.d.configFile.otherDirs.tmp.bind if self.d.inDocker else self.d.configFile.otherDirs.tmp.dir ) _envVars.BORG_BASE_DIR = ( self.d.configFile.otherDirs.base.bind if self.d.inDocker else self.d.configFile.otherDirs.base.dir ) _envVars.BORG_CONFIG_DIR = ( self.d.configFile.otherDirs.config.bind if self.d.inDocker else self.d.configFile.otherDirs.config.dir ) _envVars.BORG_SECURITY_DIR = ( self.d.configFile.otherDirs.security.bind if self.d.inDocker else self.d.configFile.otherDirs.security.dir ) _envVars.BORG_KEYS_DIR = ( self.d.configFile.otherDirs.Keys.bind if self.d.inDocker else self.d.configFile.otherDirs.Keys.dir ) if self.d.inDocker and self.d.encrypted: _envVars.BORG_PASSPHRASE = environ["BORG_PASSPHRASE"] li( colorize( "blue", 'Borg Passphrase taken from environment variable "BORG_PASSPHRASE".', ) ) elif self.d.encrypted: _envVars.BORG_PASSPHRASE = environ[ f"{self.d.device}.{self.d.repoName}.borg" ] li( colorize( "blue", 'Borg Passphrase taken from environment variable "', ) + colorize( "pink", f"{self.d.device}.{self.d.repoName}.borg", ) + colorize("blue", '".') ) self.d.envVars.update( {n: v for n, v in _envVars.items() if v} ) ls( colorize( "green", "Global environment variables updated with borg variables.", ) ) def returnCMD(self): sco = self.commands def ie(cmd, option): _: Union[str, int] = self.create[option] try: if not _: return "" elif int(_) == 1: return cmd except ValueError: return f"{cmd} {_}" except Exception as e: le( colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + colorize("pink", e) ) raise shrug() sco.excludeFrom: str = f" --exclude-from {self.d.configDir}/{self.d.device}.{self.d.repoName}/ignore/.borgignore" if any( ( self.excl.glob, self.excl.regEx, self.excl.fn, self.excl.pp, self.excl.pf, ) ) else "" li( colorize("blue", "Set\n\n") + colorize( "pink", f"{self.d.configDir}/ignore/.borgignore " ) + colorize("blue", "\n\n\t\tas ignore file.") ) sdp = self.d.configFile.otherDirs.debugProfile sdps: str = f" --debug-profile {sdp.bind if self.d.useDocker else sdp.dir}/{self.create.debugProfileFile}" sco.debugProfile: str = sdps if self.create.debugProfileFile else "" if not self.d.dryRun: sco.stats: str = ie(" --stats", "stats") sco.json: str = ie(" --json", "json") sco.filter: str = ie(" --filter", "filter") sco.progress: str = ie(" --progress", "progress") sco.excludeCaches: str = ie( " --exclude-caches", "excludeCaches" ) sco.keepTagFiles: str = ie( " --keep-tag-files", "keepTagFiles" ) sco.excludeNoDump: str = ie( " --exclude-nodump", "excludeNoDump" ) sco.oneFileSystem: str = ie( " --one-file-system", "oneFileSystem" ) sco.numericOwner: str = ie( " --numeric-owner", "numericOwner" ) sco.noATime: str = ie(" --noatime", "noATime") sco.noCTime: str = ie(" --nctime", "noCTime") sco.noBirthTime: str = ie( " --nobirthtime", "noBirthTime" ) sco.noBSDFlags: str = ie(" --nobsdflags", "noBSDFlags") sco.excludeIfPresent: str = ie( " --exclude-if-present", "excludeIfPresent" ) sco.compression: str = ie( " --compression", "compression" ) sco.chunkerParameters: str = ie( " --chunker-params", "chunkerParameters" ) sco.ignoreInode: str = ie( " --ignore-inode", "ignoreInode" ) sco.filesCache: str = ie(" --files-cache", "filesCache") sco.noCacheSync: str = ie( " --no-cache-sync", "noCacheSync" ) sco.noFilesCache: str = ie( " --no-files-cache", "noFilesCache" ) sco.readSpecial: str = ie( " --read-special", "readSpecial" ) sco.checkpointInterval: str = ie( " --checkpoint-interval", "checkpointInterval" ) sco.critical: str = ie(" --critical", "critical") sco.error: str = ie(" --error", "error") sco.warning: str = ie(" --warning", "warning") sco.info: str = ie(" --info", "info") sco.debug: str = ie(" --debug", "debug") sco.logJSON: str = ie(" --log-json", "logJSON") sco.lockWait: str = ie(" --lock-wait", "lockWait") sco.showVersion: str = ie( " --show-version", "showVersion" ) sco.showRC: str = ie(" --show-rc", "showRC") sco.umask: str = ie(" --umask", "umask") sco.remoteRateLimit: str = ie( " --remote-ratelimit", "remoteRateLimit" ) sco.considerPartFiles: str = ie( " --consider-part-files", "considerPartFiles" ) self.d.command: str = f"borg create {self.d.configFile.backup.repo.bind if self.d.useDocker else self.d.configFile.backup.repo.dir}::{self.d.name} {' '.join(self.d.configFile.backup.source.bind if self.d.useDocker else self.d.configFile.backup.source.dir)} --comment {self.d.name}" li( colorize("blue", "Unfinished command:\n\n") + colorize("pink", self.d.command) + "\n" ) if self.d.dryRun: self.d.command = self.d.command + " --dry-run" for command in sco.items(): self.d.command = self.d.command + command[1] li( colorize("blue", "Finished command:\n\n") + colorize("pink", self.d.command) + "\n" ) def endgame(self): if not self.d.dryRun: @setResetLogs(self) def inner(self): # Complete this! Log these to the log files! if self.d.useDocker: # Instantiate and connect to the default docker socket # or your environment configuration client = docker.from_env() ls( colorize( "green", "Instantiated and connected to the default docker socket / environment configuration.", ) ) try: riContainer = client.containers.run( f"shadowrylander/mm_borgbackup:{self.d.tag}", [f"borg info {self.d.repo}"], remove=True, environment=self.d.envVarList, volumes=self.d.volumes, ).decode("utf-8").split("\n") li( colorize("blue", "Repo Info for:\n\n") + colorize("pink", self.d.repo) + "\n" + colorize("blue", "\n".join([line for line in riContainer])) + "\n" ) aiContainer = client.containers.run( f"shadowrylander/mm_borgbackup:{self.d.tag}", [f"borg info {self.d.repo}::{self.d.name}"], remove=True, environment=self.d.envVarList, volumes=self.d.volumes, ).decode("utf-8").split("\n") li( colorize("blue", "Archive Info for:\n\n") + colorize("pink", f"{self.d.repo}::{self.d.name}") + "\n" + colorize("blue", "\n".join([line for line in aiContainer])) + "\n" ) ls( colorize("green", "Commands\n\n") + colorize("pink", f'"borg info {self.d.repo}" & "borg info {self.d.repo}::{self.d.name}"') + colorize( "green", "\n\n\t\trun on docker image " ) + colorize("pink", f"shadowrylander/mm_borgbackup:{self.d.tag}") + colorize("green", ".") ) except docker.errors.ContainerError as e: le( colorize("red", "Container ") + colorize("pink", "shadowrylander/mm_borgbackup") + colorize("red", " threw an error:\n\n") + colorize( "pink", "\n".join( [ line for part in tqdm(str(e).split("\n")) ] ), ) ) raise dockerError() except Exception as e: le( colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + colorize("pink", e) ) raise shrug() else: repoInfo = capture_both(f"borg info {self.d.repo}") if any(repoInfo.returncodes): le( colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + colorize("pink", "\n".join([line.rstrip() for line in TextIOWrapper(repoInfo.stderr)])) ) raise shrug() else: li( colorize("blue", "Repo Info for\n\n") + colorize("pink", self.d.repo) + "\n\n" + colorize("blue", "\n".join([line.rstrip() for line in TextIOWrapper(repoInfo.stdout)])) + "\n\n" ) archiveInfo = capture_both(f"borg info {self.d.repo}::{self.d.name}") if any(archiveInfo.returncodes): le( colorize( "red", "Sorry; something happened! This was the error:\n\n", ) + colorize("pink", "\n".join([line.rstrip() for line in TextIOWrapper(archiveInfo.stderr)])) ) raise shrug() else: li( colorize("blue", "Archive Info for\n\n") + colorize("pink", f"{self.d.repo}::{self.d.name}") + "\n\n" + colorize("blue", "\n".join([line.rstrip() for line in TextIOWrapper(archiveInfo.stdout)])) + "\n\n" ) self.d.allReturnCodes.append(0) self.d.allReturnCodes.append(0) else: pass class prune: def __init__(self, d: type): self.prune: Dict[str, Any] = D( d.configFile.arguments.prune ) self.commands: Dict[str, str] = D({}) class show: def __init__(self, d: type): self.show: Dict[str, Any] = D( d.configFile.arguments.show ) self.commands: Dict[str, str] = D({}) PK!&DDtype_classes/git/git.py# Include the GIT Username and Email, using the nanotech function. PK!type_classes/mercurial/hg.pyPK!=gMM meltan-1.0.3.0.dist-info/LICENSE GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest 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. Copyright (C) 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . 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: Copyright (C) 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. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . PK!HnHTUmeltan-1.0.3.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!Hƌ C!meltan-1.0.3.0.dist-info/METADATAMK1xwCkBPQ خEd;l>XD%=;#(P`g|Z5`P0:~|g|R$cvȖ!Oy'Ճ3X5yzoIܦ9/X@5Xk4@ZHy=%!ƥtzm"^9]_?:qB "Kd_rχ)T6T"ʮaT`#C-UPK!Hh @_~meltan-1.0.3.0.dist-info/RECORDIH໿,HV}@AE J'H"0[-,zK: p9Ԩ$<*jƖ\ izEp,`S/>=7|HvtC.g]frxM#__$8f!gu9QʅCP{䅹vQL+ˠ (G/,_I̒b$Z70dxP&>#Koո2Z KTf!6:H3~;ыF(e3hOt;ntݤլk*L/~-7!MzX`KRus-]zLcmy˅Ãi<`&赒0iUE$;vW9(U{^ [ <'LEKM}<|nqn5t/,OQ ^'E7Oz)MIQq(Z4,_*V1mw<28@:}n;җ'Ean`Q- db5wQ[;ut! F[&wW9pNEo| gp4ص(_6Ibd8Xݥ6 ~?*hj]+Gѐ[A.fŲAW .]oy[HzI-@խ~;rtռ:'OhaqPh>[r;{ESç;߱ɫ۵1)e殫{gzԛ@^BQC9K,}c}؜k =ag?2m889:( VdPK!Ū'cc.meltan/create.tomlPK!~B$$큔.meltan/device.repo.borgPK![FE.meltan/device.repo.gitPK!`G G 큽.meltan/device.repo.hgPK!]?8*.meltan/group.tomlPK!֤j~n~n W-command.pyPK!oICC create.pyPK!type_classes/__init__.pyPK!RE77 ?type_classes/borg/borg.pyPK!&DDwtype_classes/git/git.pyPK!큁wtype_classes/mercurial/hg.pyPK!=gMM wmeltan-1.0.3.0.dist-info/LICENSEPK!HnHTUFmeltan-1.0.3.0.dist-info/WHEELPK!Hƌ C!meltan-1.0.3.0.dist-info/METADATAPK!Hh @_~"meltan-1.0.3.0.dist-info/RECORDPK