Skip to content

Commit

Permalink
Fixed incompatibility between python 2-3. Renamed Update.py -> Instal…
Browse files Browse the repository at this point in the history
…l.py
  • Loading branch information
mtaghiza committed Mar 8, 2017
1 parent 99b0dcb commit bdb2ee4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 13 deletions.
56 changes: 56 additions & 0 deletions Install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/python
import sys
import os

commandLineArguments = sys.argv

# Checks whether the library is being run within the SciServer-Compute environment. Returns True if the library is being run within the SciServer-Compute environment, and False if not.
def isSciServerComputeEnvironment():
"""
Checks whether the library is being run within the SciServer-Compute environment. Returns True if the library is being run within the SciServer-Compute environment, and False if not.
"""
if os.path.isfile("/home/idies/keystone.token"):
return True
else:
return False



os.system('printf "\n---1) Updating local Git repository...\n\n"')
os.system("git tag -d $(git tag)") #deletes local tags
os.system("git fetch --all") #fetches all remotes into local repo, including tags.
os.system("git checkout master")
os.system("git reset --hard origin/master") #resets the local master branch to what was just fetched.
os.system("git clean -df") #removes all untracked files


if len(commandLineArguments) <= 1:
os.system('printf "\n---2) Checking out latest SciScript code from local master branch...\n\n"')
os.system("git checkout master")
else:
sciserverTag = commandLineArguments[1]
os.system('printf "\n---2) Checking out latest SciScript code tagged as \"" + sciserverTag + "\"...\n\n"')
os.system("git checkout tags/" + sciserverTag)

os.chdir("./py2")

os.system('printf "\n---3) Building the SciServer package for Python 2...\n\n"')

if isSciServerComputeEnvironment():
os.system("source activate py27")# activating python = python2 in anaconda
os.system("python setup.py install")
os.system("source activate root")# deactivating python = python2 in anaconda, now changing back to the anaconda default of python = python3
else:
os.system("python2 setup.py install")

os.chdir("../py3")

os.system('printf "\n---4) Building the SciServer package for Python 3...\n\n"')

if isSciServerComputeEnvironment():
os.system("python setup.py install")# In anaconda, the default is python = python3
else:
os.system("python3 setup.py install")



2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Authors: Gerard Lemson, Manuchehr Taghizadeh-Popp.

1.- Run `python ShowSciServerTags.py` in order to see the version tags that label each SciServer release containing new SciScript code.

2.- To update or install, run `python Update.py tag`, where `tag` is the version tag of the SciServer release containing the SciScript version you want to install or update to (see previous step). If `tag` is not specified, then the latest version will be installed.
2.- To install, run `python Install.py tag`, where `tag` is the version tag of the SciServer release containing the SciScript version you want to install or update to (see previous step). If `tag` is not specified, then the latest version will be installed.


## Creating HTML documentation:
Expand Down
17 changes: 5 additions & 12 deletions ShowSciServerTags.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@
import sys
import os


def sysPrint(myString): # print string to screen, depending on python version
if sys.version_info > (3, 0):
print(myString)
else:
print myString

sysPrint("\n---1) Updating local Git repository...\n\n")
os.system('printf "\n---1) Updating local Git repository...\n\n"')
os.system("git tag -d $(git tag)") #deletes local tags
os.system("git fetch --all") #fetches all remotes into local repo, including tags.
os.system("git checkout master")

sysPrint("\n--2) Listing available SciServer release version tags:\n\n")
os.system('printf "\n--2) Listing available SciServer release version tags:\n\n"')
tags = os.popen("git tag --list \"*sciserver*\"").read().split("\n")
if len(tags)==0:
sysPrint("No SciServer tags available.\n\n")
os.system('printf "No SciServer tags available.\n\n"')
else:
os.system("git tag --list \"*sciserver*\"")
os.system("git tag --list \"*sciserver*\"")

sysPrint("\n*** Refer to http://www.sciserver.org/support/updates for particular release tag details.\n\n")
os.system('printf "\n*** Refer to http://www.sciserver.org/support/updates for particular release tag details.\n\n"')

0 comments on commit bdb2ee4

Please sign in to comment.