@@ -47,6 +47,7 @@ def upload(
47
47
package_version : str ,
48
48
file_name : str ,
49
49
path : Union [str , Path ],
50
+ select : Optional [str ] = None ,
50
51
** kwargs : Any ,
51
52
) -> GenericPackage :
52
53
"""Upload a file as a generic package.
@@ -58,6 +59,7 @@ def upload(
58
59
version regex rules
59
60
file_name: The name of the file as uploaded in the registry
60
61
path: The path to a local file to upload
62
+ select: GitLab API accepts a value of 'package_file'
61
63
62
64
Raises:
63
65
GitlabConnectionError: If the server cannot be reached
@@ -77,20 +79,21 @@ def upload(
77
79
raise exc .GitlabUploadError (f"Failed to read package file { path } " ) from e
78
80
79
81
url = f"{ self ._computed_path } /{ package_name } /{ package_version } /{ file_name } "
80
- server_data = self .gitlab .http_put (url , post_data = file_data , raw = True , ** kwargs )
82
+ query_data = {} if select is None else {"select" : select }
83
+ server_data = self .gitlab .http_put (
84
+ url , query_data = query_data , post_data = file_data , raw = True , ** kwargs
85
+ )
81
86
if TYPE_CHECKING :
82
87
assert isinstance (server_data , dict )
83
88
84
- return self ._obj_cls (
85
- self ,
86
- attrs = {
87
- "package_name" : package_name ,
88
- "package_version" : package_version ,
89
- "file_name" : file_name ,
90
- "path" : path ,
91
- "message" : server_data ["message" ],
92
- },
93
- )
89
+ attrs = {
90
+ "package_name" : package_name ,
91
+ "package_version" : package_version ,
92
+ "file_name" : file_name ,
93
+ "path" : path ,
94
+ }
95
+ attrs .update (server_data )
96
+ return self ._obj_cls (self , attrs = attrs )
94
97
95
98
@cli .register_custom_action (
96
99
"GenericPackageManager" ,
0 commit comments