File: scriptutils.py

package info (click to toggle)
git-ubuntu 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,688 kB
  • sloc: python: 13,378; sh: 480; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from collections import namedtuple
import os
import sys

import pkg_resources

# We expect to be running from a git repository in master for this
# script, because the snap's python code is not exposed except within
# the snap
try:
    REALPATH = os.readlink(__file__)
except OSError:
    REALPATH = __file__
sys.path.insert(
    0,
    os.path.abspath(
        os.path.join(os.path.dirname(REALPATH), os.path.pardir)
    )
)

Defaults = namedtuple(
    'Defaults',
    [
        'num_workers',
        'denylist',
        'dry_run',
        'use_allowlist',
        'reimport',
    ],
)

DEFAULTS = Defaults(
    num_workers=10,
    denylist=pkg_resources.resource_filename(
        'gitubuntu',
        'source-package-denylist.txt',
    ),
    dry_run=False,
    use_allowlist=True,
    reimport=False,
)