glpkg 0.0.1__tar.gz → 1.0.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glpkg
3
- Version: 0.0.1
3
+ Version: 1.0.0
4
4
  Summary: Tool to make GitLab generic package registry operations easy.
5
5
  Author-email: bugproduction <bugproduction@outlook.com>
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  from gitlab.packages import Packages
2
2
 
3
- __version__ = "0.0.1"
3
+ __version__ = "1.0.0"
@@ -1,4 +1,5 @@
1
1
  import argparse
2
+ import netrc
2
3
  import os
3
4
  from gitlab import Packages, __version__
4
5
 
@@ -47,7 +48,7 @@ class CLIHandler:
47
48
  "-c",
48
49
  "--ci",
49
50
  action="store_true",
50
- help="Use this to run the tool in GitLab pipelines. In this case CI_SERVER_HOST, CI_PROJECT_ID, and CI_JOB_TOKEN variables from the environment are used. --project and --token can be used to override project ID and the CI_JOB_TOKEN to a personal or project access token.",
51
+ help="Use this in GitLab jobs. In this case CI_SERVER_HOST, CI_PROJECT_ID, and CI_JOB_TOKEN variables from the environment are used. --project and --token can be used to override project ID and the CI_JOB_TOKEN to a personal or project access token.",
51
52
  )
52
53
  parser.add_argument(
53
54
  "-p",
@@ -56,12 +57,18 @@ class CLIHandler:
56
57
  help="The project ID or path. For example 123456 or namespace/project.",
57
58
  )
58
59
  parser.add_argument("-n", "--name", type=str, help="The package name.")
59
- parser.add_argument(
60
+ group2 = parser.add_mutually_exclusive_group()
61
+ group2.add_argument(
60
62
  "-t",
61
63
  "--token",
62
64
  type=str,
63
65
  help="Private or project access token that is used to authenticate with the package registry. Leave empty if the registry is public. The token must have 'read API' or 'API' scope.",
64
66
  )
67
+ group2.add_argument(
68
+ "--netrc",
69
+ action="store_true",
70
+ help="Set to use a token from .netrc file (~/.netrc) for the host. The .netrc username is ignored due to API restrictions. PRIVATE-TOKEN is used instead. Note that .netrc file access rights must be correct.",
71
+ )
65
72
 
66
73
  def _register_download_parser(self, parser):
67
74
  self._register_common_arguments(parser)
@@ -71,21 +78,22 @@ class CLIHandler:
71
78
  def _args(self, args):
72
79
  if args.ci:
73
80
  host = os.environ["CI_SERVER_HOST"]
81
+ project = os.environ["CI_PROJECT_ID"]
82
+ token = os.environ["CI_JOB_TOKEN"]
83
+ token_user = "JOB-TOKEN"
74
84
  if args.project:
75
85
  project = args.project
76
- else:
77
- project = os.environ["CI_PROJECT_ID"]
78
86
  if args.token:
79
- token_user = "PRIVATE-TOKEN"
80
87
  token = args.token
81
- else:
82
- token_user = "JOB-TOKEN"
83
- token = os.environ["CI_JOB_TOKEN"]
88
+ token_user = "PRIVATE-TOKEN"
84
89
  else:
85
90
  host = args.host
86
91
  project = args.project
87
- token_user = "PRIVATE-TOKEN"
88
92
  token = args.token
93
+ token_user = "PRIVATE-TOKEN"
94
+ if args.netrc:
95
+ _, _, token = netrc.netrc().authenticators(host)
96
+ token_user = "PRIVATE-TOKEN"
89
97
  name = args.name
90
98
  return host, project, name, token_user, token
91
99
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glpkg
3
- Version: 0.0.1
3
+ Version: 1.0.0
4
4
  Summary: Tool to make GitLab generic package registry operations easy.
5
5
  Author-email: bugproduction <bugproduction@outlook.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes