Bug#960278: python-debian: Don't loose whitespace information when editing Copyright.files

Sandro Knauß hefee at debian.org
Mon May 11 14:36:14 BST 2020


Source: python-debian
Version: 0.1.37
Severity: normal

Hey,

currently whitespace information is lost, when modifing Copyright.files
and entries will joined with a simple space. That is correct syntax, but
not the expected behavior for a developer. Especially that the
workaround needs to access the private data element
_RestrictedWrapper__data and that is bad Python practice to access
private class members. It would be nice to have a proper way edit and store
parts without losing the whitespace information.

Here is my workaround:

for paragraph in copyright.all_files_paragraphs():
    files = list()
    for f in paragraph._RestrictedWrapper__data['Files'].splitlines():
        if match(f.strip()):
            if files:
                files.append(f)
            else:
                files.append(f.strip())
    files_entry = "\n".join(files)
    paragraph._RestrictedWrapper__data['Files'] = files_entry

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'oldstable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (100, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled



More information about the pkg-python-debian-maint mailing list