-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to build installer and uninstaller
Signed-off-by: Vitalii Koshura <[email protected]>
- Loading branch information
Showing
6 changed files
with
162 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [linux, windows] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Build | ||
run: | | ||
python build.py ${{ matrix.os }} | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Raccoon2_BOINC_Installer_${{ matrix.os }} | ||
path: | | ||
raccoon2_boinc_installer.py | ||
raccoon2_boinc_uninstaller.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.pyc | ||
raccoon2_boinc_installer.* | ||
raccoon2_boinc_uninstaller.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "CADD"] | ||
path = CADD | ||
url = https://github.com/BOINC/CADD.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,43 @@ | ||
# Raccoon2_BOINC_Plugin | ||
Raccon2 BOINC Plugin | ||
# Raccoon2 BOINC Plugin | ||
|
||
This plugin extends the functionality of Raccoon2 application by adding support for BOINC. It allows to run Raccoon2 tasks on BOINC infrastructure. | ||
For more information please visit [BOINC Central](https://boinc.berkeley.edu/central/). | ||
|
||
## Installation | ||
|
||
To install the plugin, you need to have Raccoon2 1.5.7 installed. | ||
Then, navigate to the `MGLTOOLS_FOLDER` folder, and put `raccoon2_boinc_installer.py` there. | ||
Finally, you can install the plugin using the following command: | ||
|
||
Linux/Mac: | ||
|
||
```bash | ||
./bin/pythonsh raccoon2_boinc_installer.py | ||
``` | ||
|
||
Windows: | ||
|
||
```bash | ||
python.exe raccoon2_boinc_installer.py | ||
``` | ||
|
||
where `MGLTOOLS_FOLDER` is the folder where MGLTools is installed and `PATH_TO_PLUGIN` is the path to the this folder. | ||
|
||
## Uninstallation | ||
|
||
To uninstall the plugin, navigate to the `MGLTOOLS_FOLDER` folder, and put `raccoon2_boinc_installer.py` there. | ||
Then you can use the following command: | ||
|
||
Linux/Mac: | ||
|
||
```bash | ||
./bin/pythonsh raccoon2_boinc_uninstaller.py | ||
``` | ||
|
||
Windows: | ||
|
||
```bash | ||
python.exe raccoon2_boinc_uninstaller.py | ||
``` | ||
|
||
where `MGLTOOLS_FOLDER` is the folder where MGLTools is installed and `PATH_TO_PLUGIN` is the path to the this folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import base64 | ||
import hashlib | ||
import sys | ||
|
||
os = sys.argv[1] | ||
|
||
files = [ | ||
'CADD/Raccoon2/BoincClient.py', | ||
'CADD/Raccoon2/gui/AA_setup.py', | ||
'CADD/Raccoon2/gui/BB_ligand.py', | ||
'CADD/Raccoon2/gui/CC_receptor.py', | ||
'CADD/Raccoon2/gui/EE_jobmanager.py', | ||
'CADD/Raccoon2/gui/FF_anaylsis.py', | ||
'CADD/Raccoon2/gui/Raccoon2GUI.py', | ||
'CADD/Raccoon2/gui/RaccoonEngine.py', | ||
'CADD/Raccoon2/gui/icons/boinc.png' | ||
] | ||
|
||
def get_file_hash(file): | ||
with open(file, 'rb') as f: | ||
return hashlib.sha512(f.read()).hexdigest() | ||
|
||
def get_file_content(file): | ||
with open(file, 'rb') as f: | ||
return base64.b64encode(f.read()) | ||
|
||
def build_installer_py(): | ||
with open('raccoon2_boinc_installer.py', 'w') as f: | ||
f.write('import base64\n') | ||
f.write('import hashlib\n') | ||
f.write('import os\n') | ||
f.write('import shutil\n') | ||
f.write('import sys\n') | ||
f.write('curdir = os.getcwd()\n') | ||
for file in files: | ||
hash = get_file_hash(file) | ||
content = get_file_content(file) | ||
if os == 'linux': | ||
f.write('file = curdir+\'/MGLToolsPckgs/%s\'\n' % file) | ||
elif os == 'windows': | ||
f.write('file = curdir+\'/Lib/site-packages/%s\'\n' % file) | ||
f.write('if os.path.exists(file):\n') | ||
f.write(' with open(file, \'rb\') as f:\n') | ||
f.write(' hash = hashlib.sha512(f.read()).hexdigest()\n') | ||
f.write(' if hash != \'%s\':\n' % hash) | ||
f.write(' shutil.copy(file, file+\'.orig\')\n') | ||
f.write(' with open(file, \'wb\') as f:\n') | ||
f.write(' f.write(base64.b64decode(%s))\n' % content) | ||
f.write(' else:\n') | ||
f.write(' print(\'already updated: \' + file)\n') | ||
f.write('else:\n') | ||
f.write(' with open(file, \'wb\') as f:\n') | ||
f.write(' f.write(base64.b64decode(%s))\n' % content) | ||
f.write('print (\'Done\')\n') | ||
|
||
def build_uninstaller_py(): | ||
with open('raccoon2_boinc_uninstaller.py', 'w') as f: | ||
f.write('import os\n') | ||
f.write('import shutil\n') | ||
f.write('curdir = os.getcwd()\n') | ||
for file in files: | ||
if os == 'linux': | ||
f.write('file = curdir+\'/MGLToolsPckgs/%s\'\n' % file) | ||
elif os == 'windows': | ||
f.write('file = curdir+\'/Lib/site-packages/%s\'\n' % file) | ||
f.write('if os.path.exists(file+\'.orig\'):\n') | ||
f.write(' shutil.copy(file+\'.orig\', file)\n') | ||
f.write(' os.remove(file+\'.orig\')\n') | ||
f.write('print (\'Done\')\n') | ||
|
||
def build(): | ||
for file in files: | ||
hash = get_file_hash(file) | ||
content = get_file_content(file) | ||
# print(file, hash, content) | ||
build_installer_py() | ||
build_uninstaller_py() | ||
|
||
if __name__ == "__main__": | ||
build() | ||
|