carputils
Doxygen code documentation for the python framework controlling openCARP
Functions | Variables
carputils.bundle.upload Namespace Reference

Functions related the upload of bundles to a remote git repository. More...

Functions

def check_git ()
 
def init_repo (path)
 Initializes a git repository in a folder containing a bundled experiment. More...
 
def commit_repo (path, message)
 Commits whole content of a git repository. More...
 
def push_repo (path)
 Pushes the repository containing a bundled experiment on a remote repository. More...
 
def upload_bundle (path)
 Uploads a bundled experiment on a remote repository. More...
 
def convert_name_to_reponame (name)
 Converts a string to a compatible Gitlab repository name. More...
 
def get_opencarp_docker_tag_from_codemeta (codemeta_file='codemeta.json')
 Get the openCARP docker tag corresponding to the version of openCARP specified in the codemeta file in field 'softwareRequirements'. More...
 

Variables

string GITIGNORE
 
string LICENSE
 
string NOTICE
 
string GITLAB_CI
 

Detailed Description

Functions related the upload of bundles to a remote git repository.

Function Documentation

◆ check_git()

def carputils.bundle.upload.check_git ( )

◆ commit_repo()

def carputils.bundle.upload.commit_repo (   path,
  message 
)

Commits whole content of a git repository.

Parameters
pathpath to the bundle directory

◆ convert_name_to_reponame()

def carputils.bundle.upload.convert_name_to_reponame (   name)

Converts a string to a compatible Gitlab repository name.

Parameters
nameString to convert
Returns
The Gitlab-compatible repository name

◆ get_opencarp_docker_tag_from_codemeta()

def carputils.bundle.upload.get_opencarp_docker_tag_from_codemeta (   codemeta_file = 'codemeta.json')

Get the openCARP docker tag corresponding to the version of openCARP specified in the codemeta file in field 'softwareRequirements'.

If no version is specified, return 'latest'.

◆ init_repo()

def carputils.bundle.upload.init_repo (   path)

Initializes a git repository in a folder containing a bundled experiment.

Parameters
pathpath to the bundle directory

◆ push_repo()

def carputils.bundle.upload.push_repo (   path)

Pushes the repository containing a bundled experiment on a remote repository.

The link to the remote repository should have been given as an argument to the --push-bundle option, or in codemeta.json in the codeRepository field.

Parameters
pathpath to the bundle directory
Returns
the link the remote git repository

◆ upload_bundle()

def carputils.bundle.upload.upload_bundle (   path)

Uploads a bundled experiment on a remote repository.

The link to the remote repository should have been given as an argument to the --push-bundle option, or in codemeta.json in the codeRepository field.

Parameters
pathpath to the bundle directory
Returns
the link to the remote git repository

Variable Documentation

◆ GITIGNORE

string carputils.bundle.upload.GITIGNORE
Initial value:
1 = '''
2 __pycache__/
3 *.py[cod]
4 
5 *~
6 *-
7 *.swp
8 *.save
9 .DS_Store
10 
11 /env
12 /build
13 /dist
14 /*.egg-info
15 '''

◆ GITLAB_CI

string carputils.bundle.upload.GITLAB_CI
Initial value:
1 = '''stages:
2  - test
3 
4 test-bundle:
5  stage: test
6  image: docker.opencarp.org/opencarp/opencarp:{0}
7  script:
8  - apt update -y && apt install -y jq
9  - BUNDLE_CMD=$(jq -r '.softwareHelp[0].step' codemeta.json)
10  - echo Using openCARP version {0}
11  - echo Running experiment with the command "python $BUNDLE_CMD"
12  - python $(echo $BUNDLE_CMD)
13 '''

◆ LICENSE

string carputils.bundle.upload.LICENSE

◆ NOTICE

string carputils.bundle.upload.NOTICE
Initial value:
1 = '''Copyright {0} {1}
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7  http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 '''