Browse Source

scripts: fix typos and grammar

Thomas Waldmann 1 week ago
parent
commit
404bb1ca20

+ 7 - 7
scripts/borg.exe.spec

@@ -1,5 +1,5 @@
 # -*- mode: python -*-
 # -*- mode: python -*-
-# this pyinstaller spec file is used to build borg binaries on posix platforms
+# This PyInstaller spec file is used to build Borg binaries on POSIX platforms.
 
 
 import os, sys
 import os, sys
 
 
@@ -33,8 +33,8 @@ a = Analysis([os.path.join(basepath, 'src', 'borg', '__main__.py'), ],
              cipher=block_cipher)
              cipher=block_cipher)
 
 
 if sys.platform == 'darwin':
 if sys.platform == 'darwin':
-    # do not bundle the osxfuse libraries, so we do not get a version
-    # mismatch to the installed kernel driver of osxfuse.
+    # Do not bundle the macFUSE libraries to avoid a version
+    # mismatch with the installed macFUSE kernel driver.
     a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]]
     a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]]
 
 
 pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
 pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
@@ -51,10 +51,10 @@ exe = EXE(pyz,
           console=True)
           console=True)
 
 
 # Build a directory-based binary in addition to a packed
 # Build a directory-based binary in addition to a packed
-# single file. This allows one to easily look at all included
-# files (e.g. without having to strace or halt the built binary
-# and introspect /tmp). Also avoids unpacking all libs when
-# running the app, which is better for app signing on various OS.
+# single-file. This allows one to easily look at all included
+# files (e.g., without having to strace or halt the built binary
+# and introspect /tmp). Also avoids unpacking all libraries when
+# running the app, which is better for app signing on various operating systems.
 slim_exe = EXE(pyz,
 slim_exe = EXE(pyz,
             a.scripts,
             a.scripts,
             exclude_binaries=True,
             exclude_binaries=True,

+ 8 - 8
scripts/errorlist.py

@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
-# this script automatically generates the error list for the docs by
+# This script automatically generates the error list for the docs by
 # looking at the "Error" class and its subclasses.
 # looking at the "Error" class and its subclasses.
 
 
 from textwrap import indent
 from textwrap import indent
@@ -14,14 +14,14 @@ def subclasses(cls):
     return set(direct_subclasses) | set(s for c in direct_subclasses for s in subclasses(c))
     return set(direct_subclasses) | set(s for c in direct_subclasses for s in subclasses(c))
 
 
 
 
-# 0, 1, 2 are used for success, generic warning, generic error
-# 3..99 are available for specific errors
-# 100..127 are available for specific warnings
-# 128+ are reserved for signals
+# 0, 1, 2 are used for success, generic warning, generic error.
+# 3..99 are available for specific errors.
+# 100..127 are available for specific warnings.
+# 128+ are reserved for signals.
 free_error_rcs = set(range(EXIT_ERROR_BASE, EXIT_WARNING_BASE))  # 3 .. 99
 free_error_rcs = set(range(EXIT_ERROR_BASE, EXIT_WARNING_BASE))  # 3 .. 99
 free_warning_rcs = set(range(EXIT_WARNING_BASE, EXIT_SIGNAL_BASE))  # 100 .. 127
 free_warning_rcs = set(range(EXIT_WARNING_BASE, EXIT_SIGNAL_BASE))  # 100 .. 127
 
 
-# these classes map to rc 2
+# These classes map to rc 2
 generic_error_rc_classes = set()
 generic_error_rc_classes = set()
 generic_warning_rc_classes = set()
 generic_warning_rc_classes = set()
 
 
@@ -37,7 +37,7 @@ for cls in sorted(error_classes, key=lambda cls: (cls.__module__, cls.__qualname
     elif rc == 2:
     elif rc == 2:
         generic_error_rc_classes.add(cls.__qualname__)
         generic_error_rc_classes.add(cls.__qualname__)
     else:  # rc != 2
     else:  # rc != 2
-        # if we did not intentionally map this to the generic error rc, this might be an issue:
+        # If we did not intentionally map this to the generic error rc, this might be an issue:
         print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid')
         print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid')
 
 
 print()
 print()
@@ -55,7 +55,7 @@ for cls in sorted(warning_classes, key=lambda cls: (cls.__module__, cls.__qualna
     elif rc == 1:
     elif rc == 1:
         generic_warning_rc_classes.add(cls.__qualname__)
         generic_warning_rc_classes.add(cls.__qualname__)
     else:  # rc != 1
     else:  # rc != 1
-        # if we did not intentionally map this to the generic warning rc, this might be an issue:
+        # If we did not intentionally map this to the generic warning rc, this might be an issue:
         print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid')
         print(f'ERROR: {rc} is not a free/available RC, but either duplicate or invalid')
 
 
 print("\n")
 print("\n")

+ 6 - 6
scripts/hash_sizes.py

@@ -1,13 +1,13 @@
 """
 """
-Compute hashtable sizes with nices properties
+Compute hash table sizes with nice properties:
 - prime sizes (for small to medium sizes)
 - prime sizes (for small to medium sizes)
-- 2 prime-factor sizes (for big sizes)
+- two prime-factor sizes (for big sizes)
 - fast growth for small sizes
 - fast growth for small sizes
 - slow growth for big sizes
 - slow growth for big sizes
 
 
 Note:
 Note:
-     this is just a tool for developers.
-     within borgbackup, it is just used to generate hash_sizes definition for _hashindex.c.
+    This is just a tool for developers.
+    Within BorgBackup, it is only used to generate the hash_sizes definition for _hashindex.c.
 """
 """
 
 
 from collections import namedtuple
 from collections import namedtuple
@@ -20,7 +20,7 @@ start, end_p1, end_p2 = 1 * K, 127 * M, 2 * G - 10 * M  # stay well below 2^31 -
 Policy = namedtuple("Policy", "upto grow")
 Policy = namedtuple("Policy", "upto grow")
 
 
 policies = [
 policies = [
-    # which growth factor to use when growing a hashtable of size < upto
+    # which growth factor to use when growing a hash table of size < upto
     # grow fast (*2.0) at the start so we do not have to resize too often (expensive).
     # grow fast (*2.0) at the start so we do not have to resize too often (expensive).
     # grow slow (*1.1) for huge hash tables (do not jump too much in memory usage)
     # grow slow (*1.1) for huge hash tables (do not jump too much in memory usage)
     Policy(256*K, 2.0),
     Policy(256*K, 2.0),
@@ -85,7 +85,7 @@ def main():
         sizes.append(p)
         sizes.append(p)
         i = int(i * grow_factor)
         i = int(i * grow_factor)
 
 
-    gen = two_prime_factors()  # for lower ram consumption
+    gen = two_prime_factors()  # for lower RAM consumption
     while i < end_p2:
     while i < end_p2:
         grow_factor = get_grow_factor(i)
         grow_factor = get_grow_factor(i)
         p = find_bigger_prime(gen, i)
         p = find_bigger_prime(gen, i)

+ 5 - 5
scripts/make.py

@@ -23,7 +23,7 @@ def format_metavar(option):
 
 
 
 
 class BuildUsage:
 class BuildUsage:
-    """generate usage docs for each command"""
+    """Generate usage docs for each command."""
 
 
     def run(self):
     def run(self):
         print('generating usage docs')
         print('generating usage docs')
@@ -31,11 +31,11 @@ class BuildUsage:
         borg.doc_mode = 'build_man'
         borg.doc_mode = 'build_man'
         if not os.path.exists('docs/usage'):
         if not os.path.exists('docs/usage'):
             os.mkdir('docs/usage')
             os.mkdir('docs/usage')
-        # allows us to build docs without the C modules fully loaded during help generation
+        # Allows us to build docs without the C modules fully loaded during help generation
         from borg.archiver import Archiver
         from borg.archiver import Archiver
         parser = Archiver(prog='borg').build_parser()
         parser = Archiver(prog='borg').build_parser()
-        # borgfs has a separate man page to satisfy debian's "every program from a package
-        # must have a man page" requirement, but it doesn't need a separate HTML docs page
+        # borgfs has a separate man page to satisfy Debian's "every program from a package
+        # must have a man page" requirement, but it does not need a separate HTML docs page.
         #borgfs_parser = Archiver(prog='borgfs').build_parser()
         #borgfs_parser = Archiver(prog='borgfs').build_parser()
 
 
         self.generate_level("", parser, Archiver)
         self.generate_level("", parser, Archiver)
@@ -290,7 +290,7 @@ class BuildMan:
         import borg
         import borg
         borg.doc_mode = 'build_man'
         borg.doc_mode = 'build_man'
         os.makedirs('docs/man', exist_ok=True)
         os.makedirs('docs/man', exist_ok=True)
-        # allows us to build docs without the C modules fully loaded during help generation
+        # Allows us to build docs without the C modules fully loaded during help generation
         from borg.archiver import Archiver
         from borg.archiver import Archiver
         parser = Archiver(prog='borg').build_parser()
         parser = Archiver(prog='borg').build_parser()
         borgfs_parser = Archiver(prog='borgfs').build_parser()
         borgfs_parser = Archiver(prog='borgfs').build_parser()

+ 5 - 5
scripts/shell_completions/bash/borg

@@ -1,7 +1,7 @@
-# Completions for borg
+# Completions for Borg
 # https://www.borgbackup.org/
 # https://www.borgbackup.org/
 # Note:
 # Note:
-# Listing archives works on password protected repositories only if $BORG_PASSPHRASE is set.
+# Listing archives works on password-protected repositories only if $BORG_PASSPHRASE is set.
 # Install:
 # Install:
 # Copy this file to /usr/share/bash-completion/completions/ or /etc/bash_completion.d/
 # Copy this file to /usr/share/bash-completion/completions/ or /etc/bash_completion.d/
 
 
@@ -57,7 +57,7 @@ _borg()
             return 0
             return 0
             ;;
             ;;
         '-o')
         '-o')
-            # FIXME This list is probably not full, but I tried to pick only those that are relevant to borg mount -o:
+            # FIXME: This list is probably not complete, but it includes options relevant to 'borg mount -o':
             local fuse_options="ac_attr_timeout= allow_damaged_files allow_other allow_root attr_timeout= auto auto_cache auto_unmount default_permissions entry_timeout= gid= group_id= kernel_cache max_read= negative_timeout= noauto noforget remember= remount rootmode= uid= umask= user user_id= versions"
             local fuse_options="ac_attr_timeout= allow_damaged_files allow_other allow_root attr_timeout= auto auto_cache auto_unmount default_permissions entry_timeout= gid= group_id= kernel_cache max_read= negative_timeout= noauto noforget remember= remount rootmode= uid= umask= user user_id= versions"
             COMPREPLY=( $(compgen -W "${fuse_options}" -- ${cur}) )
             COMPREPLY=( $(compgen -W "${fuse_options}" -- ${cur}) )
             return 0
             return 0
@@ -162,11 +162,11 @@ _borg()
     if [[ ${prev} == "::" ]] ; then
     if [[ ${prev} == "::" ]] ; then
         list_archives=1
         list_archives=1
     fi
     fi
-    # Second archive listing for borg diff
+    # Second archive listing for 'borg diff'
     if [[ ${COMP_LINE} =~ ^.*\ diff\ .*::[^\ ]+\ ${cur}$ ]] ; then
     if [[ ${COMP_LINE} =~ ^.*\ diff\ .*::[^\ ]+\ ${cur}$ ]] ; then
         list_archives=1
         list_archives=1
     fi
     fi
-    # Additional archive listing for borg delete
+    # Additional archive listing for 'borg delete'
     if [[ ${COMP_LINE} =~ ^.*\ delete\ .*::[^\ ]+.*${cur}$ ]] ; then
     if [[ ${COMP_LINE} =~ ^.*\ delete\ .*::[^\ ]+.*${cur}$ ]] ; then
         list_archives=1
         list_archives=1
     fi
     fi

+ 5 - 5
scripts/shell_completions/fish/borg.fish

@@ -1,7 +1,7 @@
-# Completions for borg
+# Completions for Borg
 # https://www.borgbackup.org/
 # https://www.borgbackup.org/
 # Note:
 # Note:
-# Listing archives works on password protected repositories only if $BORG_PASSPHRASE is set.
+# Listing archives works on password-protected repositories only if $BORG_PASSPHRASE is set.
 # Install:
 # Install:
 # Copy this file to /usr/share/fish/vendor_completions.d/
 # Copy this file to /usr/share/fish/vendor_completions.d/
 
 
@@ -19,7 +19,7 @@ complete -c borg -f -n __fish_is_first_token -a 'prune' -d 'Prune repository arc
 complete -c borg -f -n __fish_is_first_token -a 'compact' -d 'Free repository space'
 complete -c borg -f -n __fish_is_first_token -a 'compact' -d 'Free repository space'
 complete -c borg -f -n __fish_is_first_token -a 'info' -d 'Show archive details'
 complete -c borg -f -n __fish_is_first_token -a 'info' -d 'Show archive details'
 complete -c borg -f -n __fish_is_first_token -a 'mount' -d 'Mount archive or a repository'
 complete -c borg -f -n __fish_is_first_token -a 'mount' -d 'Mount archive or a repository'
-complete -c borg -f -n __fish_is_first_token -a 'umount' -d 'Un-mount the mounted archive'
+complete -c borg -f -n __fish_is_first_token -a 'umount' -d 'Unmount the mounted archive'
 
 
 function __fish_borg_seen_key
 function __fish_borg_seen_key
     if __fish_seen_subcommand_from key
     if __fish_seen_subcommand_from key
@@ -48,8 +48,8 @@ function __fish_borg_seen_benchmark
     end
     end
     return 1
     return 1
 end
 end
-complete -c borg -f -n __fish_is_first_token -a 'benchmark' -d 'Benchmark borg operations'
-complete -c borg -f -n __fish_borg_seen_benchmark -a 'crud' -d 'Benchmark borg CRUD operations'
+complete -c borg -f -n __fish_is_first_token -a 'benchmark' -d 'Benchmark Borg operations'
+complete -c borg -f -n __fish_borg_seen_benchmark -a 'crud' -d 'Benchmark Borg CRUD operations'
 
 
 function __fish_borg_seen_help
 function __fish_borg_seen_help
     if __fish_seen_subcommand_from help
     if __fish_seen_subcommand_from help

+ 1 - 1
scripts/shell_completions/zsh/_borg

@@ -51,7 +51,7 @@ _borg_commands() {
     'recreate:re-create archives'
     'recreate:re-create archives'
     'rename:rename an existing archive'
     'rename:rename an existing archive'
     'serve:start in server mode'
     'serve:start in server mode'
-    'umount:un-mount the FUSE filesystem'
+    'umount:unmount the FUSE filesystem'
     'upgrade:upgrade a repository from a previous version'
     'upgrade:upgrade a repository from a previous version'
     'with-lock:run a user specified command with the repository lock held'
     'with-lock:run a user specified command with the repository lock held'
   )
   )