Skip to content

Commit a548201

Browse files
committed
remove master ref from gitstrap
1 parent e31de3c commit a548201

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

‎install/gitstrap.py‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
# installed. Override this with --log
7979

8080
branch=None # name of git branch to install. None (default)
81-
# causes the default (currently "master")
82-
# to be used
81+
# causes the default ("main") to be used
8382

8483
# option not yet implemented (not sure yet how to handle proxy settings)
8584

@@ -90,6 +89,7 @@
9089
if '-r' in a.lower():
9190
reset = True
9291
skipShortcut = True
92+
break
9393
elif '-nop' in a.lower():
9494
ProgressCnt = False
9595
elif '-nos' in a.lower():
@@ -234,6 +234,8 @@
234234
--reset Removes any locally-changed GSAS-II files and updates to
235235
the latest GSAS-II version. Useful when GSAS-II will not
236236
start. --noshortcut is set when --reset is used.
237+
This option needs more testing.
238+
Contact Brian if it seems to fail.
237239
238240
--help shows this message
239241
@@ -312,7 +314,7 @@ def gitInstallGSASII(repo_URL,repo_path,depth=500,forceupdate=False,verbose=True
312314
is raised.
313315
314316
If a .git repostory is found at the location, the GSAS-II files
315-
will be updated to the latest version in the master repository, unless
317+
will be updated to the latest version in the main repository, unless
316318
locally made changes have been made to those files. If changes have
317319
been made then `forceupdate` must be set as True for the update to
318320
be applied, otherwise a UserWarning Exception is generated.
@@ -394,7 +396,7 @@ def gitResetGSASII(repo_path,verbose=True):
394396
if no repository is at that location.
395397
'''
396398
if os.path.exists(os.path.join(repo_path,'.git')):
397-
git.Repo(repo_path).git.reset('--hard','origin/master')
399+
git.Repo(repo_path).git.reset('--hard','origin/main')
398400
return True
399401
else:
400402
if verbose: print(f'Warning: Repository {repo_path} not found')
@@ -438,14 +440,16 @@ def gitResetGSASII(repo_path,verbose=True):
438440
if gitResetGSASII(path2repo):
439441
print('git reset performed')
440442
else:
441-
print('reset failed')
443+
msg = 'git reset failed'
444+
BailOut(msg)
442445

443446
if not skipDownload:
444447
try:
445448
gitInstallGSASII(g2URL,path2repo,depth=depth,branch=branch) # forceupdate=False
446449
except UserWarning:
447-
print('\n***Unable to update due to changes that have been made locally to GSAS-II files')
448-
print('If an update must be done from inside this script, use --reset')
450+
msg = '\n***Unable to update due to changes that have been made locally to GSAS-II files'
451+
msg += '\nIf an update must be done from inside this script, use --reset'
452+
BailOut(msg)
449453

450454
# GSAS-II files now present, start on binary installation
451455
sys.path.insert(0,path2GSAS2)
@@ -454,7 +458,7 @@ def gitResetGSASII(repo_path,verbose=True):
454458
except:
455459
print('import of GSASIIpath failed, why?')
456460
sys.exit()
457-
461+
458462
# do install of binaries
459463
# TODO: this may fail currently if the binaries have already been installed
460464
# and file protections are not set to allow overwrite.
@@ -507,7 +511,7 @@ def gitResetGSASII(repo_path,verbose=True):
507511
compileall.compile_dir(path2GSAS2,quiet=True)
508512
print('done')
509513
# import the PyCifRW package. This creates the .pyc files. A warning is
510-
# generated in versions <5.0, but avoids an error in pytest due to that
514+
# generated in versions <5.0, but avoids a pytest error due to that
511515
# warning.
512516
try:
513517
import CifFile

0 commit comments

Comments
 (0)