Skip to content

Commit

Permalink
documentation and version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiihne-noaa authored Nov 14, 2024
1 parent 96f79ef commit 744c3a5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions fre/pp/checkoutScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ def _checkoutTemplate(experiment, platform, target, branch=None):

# branch and version parameters
default_tag = subprocess.run(["fre","--version"],capture_output=True, text=True).stdout.split()[2]
if default_tag == '2024.1': #hard coded solution to current discrepencies with fre --version
default_tag = '2024.01'

if branch is not None:
if os.path.isdir(name): #scenario 4
if os.path.isdir(name): #scenario 4
os.chdir(name)
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout.split('*')
name_path_branch=subprocess.run(["git","branch"],capture_output=True, text=True).stdout
Expand All @@ -47,9 +50,14 @@ def _checkoutTemplate(experiment, platform, target, branch=None):
stop_report = f"Tag and branch of prexisting directory {directory}/{name} does not match fre --version or branch requested"
sys.exit(stop_report)
return 1
print('directory exists, and branch requested matches branch in use')

else: #scenario 2
subprocess.run(['git', 'clone', f'--branch={branch}', '--recursive', 'https://github.com/NOAA-GFDL/fre-workflows.git', f'{name}'])
clone_output = subprocess.run(['git', 'clone', f'--branch={branch}', '--recursive', 'https://github.com/NOAA-GFDL/fre-workflows.git', f'{name}'], capture_output=True, text=True)
print('output of fre pp checkouts git clone command is as follows:',clone_output)
else:
print('the default tag for directory ',directory,'/',name, ' is ', default_tag)

if os.path.isdir(name): #scenario 3
os.chdir(name)
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout.split()[0]
Expand All @@ -58,9 +66,11 @@ def _checkoutTemplate(experiment, platform, target, branch=None):
stop_report = f"Tag of prexisting directory {diretory}/{name} does not match fre --version"
sys.exit(stop_report)
return 1
print('directory exists, and its branch matches default tag')

else: #scenario 1
subprocess.run(['git', 'clone', '-b',f'{default_tag}', '--recursive', 'https://github.com/NOAA-GFDL/fre-workflows.git', f'{name}'])

clone_output = subprocess.run(['git', 'clone', '-b',f'{default_tag}', '--recursive', 'https://github.com/NOAA-GFDL/fre-workflows.git', f'{name}'], capture_output=True, text=True)
print('output of fre pp checkouts git clone command is as follows:',clone_output)

#############################################

Expand Down

0 comments on commit 744c3a5

Please sign in to comment.