argparse-from-file 1.1__tar.gz → 1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {argparse_from_file-1.1/argparse_from_file.egg-info → argparse_from_file-1.2}/PKG-INFO +1 -1
- {argparse_from_file-1.1 → argparse_from_file-1.2/argparse_from_file.egg-info}/PKG-INFO +1 -1
- {argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.py +17 -2
- {argparse_from_file-1.1 → argparse_from_file-1.2}/.gitignore +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/Makefile +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/README.md +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.egg-info/SOURCES.txt +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.egg-info/dependency_links.txt +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.egg-info/requires.txt +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.egg-info/top_level.txt +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/pyproject.toml +0 -0
- {argparse_from_file-1.1 → argparse_from_file-1.2}/setup.cfg +0 -0
|
@@ -5,15 +5,30 @@ file.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import argparse
|
|
8
|
+
import os
|
|
8
9
|
import shlex
|
|
9
10
|
import sys
|
|
10
|
-
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
import platformdirs
|
|
13
13
|
|
|
14
14
|
PLACEHOLDER = '#FROM_FILE_PATH#'
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
# Get program name. This function is copied (but very modified) from argparse 3.14.0
|
|
18
|
+
def _prog_name():
|
|
19
|
+
try:
|
|
20
|
+
modspec = sys.modules['__main__'].__spec__
|
|
21
|
+
except (KeyError, AttributeError):
|
|
22
|
+
# possibly PYTHONSTARTUP or -X presite or other weird edge case
|
|
23
|
+
# no good answer here, so fall back to the default
|
|
24
|
+
modspec = None
|
|
25
|
+
|
|
26
|
+
if not modspec or modspec.name == '__main__':
|
|
27
|
+
return os.path.basename(sys.argv[0])
|
|
28
|
+
|
|
29
|
+
return modspec.name.removesuffix('.__main__')
|
|
30
|
+
|
|
31
|
+
|
|
17
32
|
class ArgumentParser(argparse.ArgumentParser):
|
|
18
33
|
_top = True
|
|
19
34
|
|
|
@@ -29,7 +44,7 @@ class ArgumentParser(argparse.ArgumentParser):
|
|
|
29
44
|
# from_file = '': Do not use a "from file".
|
|
30
45
|
# from_file = None: Create default "from file" path.
|
|
31
46
|
if (from_file := kwargs.pop('from_file', None)) is None:
|
|
32
|
-
from_file =
|
|
47
|
+
from_file = _prog_name() + '-flags.conf'
|
|
33
48
|
|
|
34
49
|
if from_file:
|
|
35
50
|
from_file_path = platformdirs.user_config_path(from_file)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argparse_from_file-1.1 → argparse_from_file-1.2}/argparse_from_file.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|