Skip to content

Commit 0927e61

Browse files
authored
Merge pull request #1 from BOINC/vko_create_plugin_installaion_and_deinstallation_scripts
Add script to build installer and uninstaller
2 parents 95bfa36 + 3d0ad3a commit 0927e61

File tree

6 files changed

+161
-34
lines changed

6 files changed

+161
-34
lines changed

.github/workflows/build.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
os: [linux, macos, windows]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
- name: Build
23+
run: |
24+
python build.py ${{ matrix.os }}
25+
- name: Upload Artifact
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: Raccoon2_BOINC_Installer_${{ matrix.os }}
29+
path: |
30+
raccoon2_boinc_installer.py
31+
README.md

.gitignore

+2-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,2 @@
1-
# Prerequisites
2-
*.d
3-
4-
# Compiled Object files
5-
*.slo
6-
*.lo
7-
*.o
8-
*.obj
9-
10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Compiled Dynamic libraries
15-
*.so
16-
*.dylib
17-
*.dll
18-
19-
# Fortran module files
20-
*.mod
21-
*.smod
22-
23-
# Compiled Static libraries
24-
*.lai
25-
*.la
26-
*.a
27-
*.lib
28-
29-
# Executables
30-
*.exe
31-
*.out
32-
*.app
1+
*.pyc
2+
raccoon2_boinc_installer.py

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "CADD"]
2+
path = CADD
3+
url = https://github.com/BOINC/CADD.git

CADD

Submodule CADD added at ef47df0

README.md

+51-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,51 @@
1-
# Raccoon2_BOINC_Plugin
2-
Raccon2 BOINC Plugin
1+
# Raccoon2 BOINC Plugin
2+
3+
This plugin extends the functionality of [Raccoon2](https://autodock.scripps.edu/resources/raccoon2/) application by adding support for [BOINC](https://boinc.berkeley.edu/).
4+
5+
It allows to run [Autodock Vina](https://vina.scripps.edu/) tasks on [BOINC Central](https://boinc.berkeley.edu/central/) infrastructure.
6+
7+
IMPORTANT: To submit tasks to [BOINC Central](https://boinc.berkeley.edu/central/), please [contact](https://boinc.berkeley.edu/anderson/) us.
8+
9+
## Installation
10+
11+
To install the plugin, you need to have Raccoon2 1.5.7 installed.
12+
13+
Then, navigate to the `MGLTOOLS_FOLDER` folder, and put `raccoon2_boinc_installer.py` there.
14+
15+
Finally, you can install the plugin using the following command:
16+
17+
### Linux/Mac:
18+
19+
```bash
20+
./bin/pythonsh raccoon2_boinc_installer.py install
21+
```
22+
23+
### Windows:
24+
Before running the command, you need to start `cmd` as an administrator, then navigate to the `MGLTOOLS_FOLDER` folder.
25+
26+
```bash
27+
python.exe raccoon2_boinc_installer.py install
28+
```
29+
30+
where `MGLTOOLS_FOLDER` is the folder where MGLTools is installed and `PATH_TO_PLUGIN` is the path to the this folder.
31+
32+
## Uninstallation
33+
34+
To uninstall the plugin, navigate to the `MGLTOOLS_FOLDER` folder, and put `raccoon2_boinc_installer.py` there.
35+
36+
Then you can use the following command:
37+
38+
### Linux/Mac:
39+
40+
```bash
41+
./bin/pythonsh raccoon2_boinc_installer.py uninstall
42+
```
43+
44+
### Windows:
45+
Before running the command, you need to start `cmd` as an administrator, then navigate to the `MGLTOOLS_FOLDER` folder.
46+
47+
```bash
48+
python.exe raccoon2_boinc_installer.py uninstall
49+
```
50+
51+
where `MGLTOOLS_FOLDER` is the folder where MGLTools is installed and `PATH_TO_PLUGIN` is the path to the this folder.

build.py

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import base64
2+
import hashlib
3+
import sys
4+
5+
os = sys.argv[1]
6+
7+
files = [
8+
'CADD/Raccoon2/BoincClient.py',
9+
'CADD/Raccoon2/gui/AA_setup.py',
10+
'CADD/Raccoon2/gui/BB_ligand.py',
11+
'CADD/Raccoon2/gui/CC_receptor.py',
12+
'CADD/Raccoon2/gui/EE_jobmanager.py',
13+
'CADD/Raccoon2/gui/FF_anaylsis.py',
14+
'CADD/Raccoon2/gui/Raccoon2GUI.py',
15+
'CADD/Raccoon2/gui/RaccoonEngine.py',
16+
'CADD/Raccoon2/gui/icons/boinc.png'
17+
]
18+
19+
def get_file_hash(file):
20+
with open(file, 'rb') as f:
21+
return hashlib.sha512(f.read()).hexdigest()
22+
23+
def get_file_content(file):
24+
with open(file, 'rb') as f:
25+
return base64.b64encode(f.read())
26+
27+
def build_installer_py():
28+
with open('raccoon2_boinc_installer.py', 'w') as f:
29+
f.write('# IMPORTANT: Do not run this file directly.\n')
30+
f.write('# Please read README.md first for usage instructions.\n')
31+
f.write('import base64\n')
32+
f.write('import hashlib\n')
33+
f.write('import os\n')
34+
f.write('import shutil\n')
35+
f.write('import sys\n')
36+
f.write('curdir = os.getcwd()\n')
37+
f.write('if len(sys.argv) > 1 and sys.argv[1] == \'install\':\n')
38+
for file in files:
39+
hash = get_file_hash(file)
40+
content = get_file_content(file)
41+
if os == 'linux' or os == 'macos':
42+
f.write(' file = curdir+\'/MGLToolsPckgs/%s\'\n' % file)
43+
elif os == 'windows':
44+
f.write(' file = curdir+\'/Lib/site-packages/%s\'\n' % file)
45+
f.write(' content = %s\n' % content)
46+
f.write(' if os.path.exists(file):\n')
47+
f.write(' with open(file, \'rb\') as f:\n')
48+
f.write(' hash = hashlib.sha512(f.read()).hexdigest()\n')
49+
f.write(' if hash != \'%s\':\n' % hash)
50+
f.write(' shutil.copy(file, file+\'.orig\')\n')
51+
f.write(' with open(file, \'wb\') as f:\n')
52+
f.write(' f.write(base64.b64decode(content))\n')
53+
f.write(' else:\n')
54+
f.write(' print(\'already updated: \' + file)\n')
55+
f.write(' else:\n')
56+
f.write(' with open(file, \'wb\') as f:\n')
57+
f.write(' f.write(base64.b64decode(content))\n')
58+
f.write(' print (\'Done\')\n')
59+
f.write('elif len(sys.argv) > 1 and sys.argv[1] == \'uninstall\':\n')
60+
for file in files:
61+
if os == 'linux' or os == 'macos':
62+
f.write(' file = curdir+\'/MGLToolsPckgs/%s\'\n' % file)
63+
elif os == 'windows':
64+
f.write(' file = curdir+\'/Lib/site-packages/%s\'\n' % file)
65+
f.write(' if os.path.exists(file+\'.orig\'):\n')
66+
f.write(' shutil.copy(file+\'.orig\', file)\n')
67+
f.write(' os.remove(file+\'.orig\')\n')
68+
f.write(' print (\'Done\')\n')
69+
f.write('else:\n')
70+
f.write(' print (\'Please read README.md for usage instructions.\')\n')
71+
72+
if __name__ == "__main__":
73+
build_installer_py()

0 commit comments

Comments
 (0)