repositorytools.lib package¶
Submodules¶
repositorytools.lib.artifact module¶
-
exception
repositorytools.lib.artifact.
NameVerDetectionError
[source]¶ Bases:
repositorytools.lib.artifact.ArtifactError
-
class
repositorytools.lib.artifact.
Artifact
(group, artifact='', version='', classifier='', extension='')[source]¶ Bases:
object
Generic class describing an artifact
-
class
repositorytools.lib.artifact.
LocalArtifact
(group, local_path, artifact='', version='', classifier='', extension='')[source]¶ Bases:
repositorytools.lib.artifact.Artifact
Artifact for upload to repository
-
class
repositorytools.lib.artifact.
LocalRpmArtifact
(local_path, group=None)[source]¶ Bases:
repositorytools.lib.artifact.LocalArtifact
Special case of local artifact, which can detect it’s coordinates from RPM metadata
-
class
repositorytools.lib.artifact.
RemoteArtifact
(group=None, artifact='', version='', classifier='', extension='', url=None, repo_id=None)[source]¶ Bases:
repositorytools.lib.artifact.Artifact
Artifact in repository
repositorytools.lib.repository module¶
Contains classes for manipulating with a repository server
-
exception
repositorytools.lib.repository.
RepositoryClientError
[source]¶ Bases:
exceptions.Exception
Base exception raised when working with NexusRepositoryClient and its descendants
-
class
repositorytools.lib.repository.
NexusRepositoryClient
(repository_url=None, user=None, password=None, verify_ssl=True)[source]¶ Bases:
object
Class for working with Sonatype Nexus OSS
-
DEFAULT_REPOSITORY_URL
= 'https://repository'¶
-
upload_artifacts
(local_artifacts, repo_id, print_created_artifacts=True, _hostname_for_download=None, _path_prefix='content/repositories', use_direct_put=False)[source]¶ Uploads artifacts to repository.
Parameters: - local_artifacts – list[LocalArtifact]
- repo_id – id of target repository
- print_created_artifacts – if True prints to stdout what was uploaded and where
Returns: list[RemoteArtifact]
-
-
class
repositorytools.lib.repository.
NexusProRepositoryClient
(repository_url=None, user=None, password=None, verify_ssl=True, staging_repository_url=None)[source]¶ Bases:
repositorytools.lib.repository.NexusRepositoryClient
Class for working with Sonatype Nexus Professional
-
close_staging_repo
(repo_id, description='')[source]¶ Closes a staging repository. After close, no files can be added.
Parameters: - repo_id – id of staging repository
- description – if specified, updates description of staged repository
Returns:
-
close_staging_repos
(repo_ids, description='')[source]¶ Closes multiple staging repositories.
Parameters: - repo_ids – list of repo IDs (strings) For description of other params see close_staging_repo.
- description – Description message.
Returns:
-
create_staging_repo
(profile_name, description)[source]¶ Creates a staging repository :param profile_name: name of staging profile :param description: description of created staging repository :return: id of newly created staging repository
-
drop_staging_repo
(repo_id, description='No description')[source]¶ Deletes a staging repository and all artifacts inside.
Parameters: repo_id – id of staging repository Returns:
-
drop_staging_repos
(repo_ids, description='No description')[source]¶ Deletes multiple staging repositories.
Parameters: repo_ids – list of repo IDs (strings) Returns:
-
get_artifact_metadata
(remote_artifact)[source]¶ Gets artifact’s maven metadata.
Metadata capability needs to be enabled to use this. Also indexing has to be enabled for that repo to make it work.
Parameters: remote_artifact – Returns:
-
list_staging_repos
(filter_dict=None)[source]¶ Parameters: filter_dict – dictionary with filters, for example {‘description’:’foo’} Returns: list of dictionaries, each dict describes one staging repo
-
release_staging_repo
(repo_id, description='No description', auto_drop_after_release=True, keep_metadata=False)[source]¶ Releases all contents of a staging repository to a release repository which this staging repository targets.
Parameters: - repo_id – id of staging repository
- description –
- auto_drop_after_release – set this to True if you want to delete the staging repository after releasing
- keep_metadata – Keeps custom maven metadata of artifacts after release. Works only there is list of artifacts created by upload_artifacts_to_new_staging with upload_filelist=False. It is because current Nexus 2.x can’t do keep the metadata after release, so we manually read the metadata, release and then set them again.
Returns:
-
set_artifact_metadata
(remote_artifact, metadata)[source]¶ Sets artifact metadata.
The same requirements as for get_artifact_metadata have to be met.
Parameters: - remote_artifact –
- metadata – dict of keys and values you want to save there
Returns:
-
upload_artifacts_to_new_staging
(local_artifacts, repo_id, print_created_artifacts=True, description='No description', upload_filelist=False)[source]¶ Creates a staging repository in staging profile with name repo_id and uploads local_artifacts there.
Parameters: - local_artifacts – list[LocalArtifact]
- repo_id – name of target repository
- print_created_artifacts – if True prints to stdout what was uploaded and where
- description – description of staging repo
- upload_filelist – see upload_artifacts_to_staging
Returns: list[RemoteArtifact]
-
upload_artifacts_to_staging
(local_artifacts, repo_id, print_created_artifacts=True, upload_filelist=False)[source]¶ Parameters: - local_artifacts – list[LocalArtifact]
- repo_id – name of staging repository
- print_created_artifacts – if True prints to stdout what was uploaded and where
- staging – bool
- upload_filelist – if True, creates and uploads a list of uploaded files
Returns: list[RemoteArtifact]
-