1
1
import os
2
2
import subprocess
3
+ import sys
3
4
4
5
def run_command (command ):
5
6
result = subprocess .run (command , shell = True , capture_output = False , text = True )
6
7
if result .returncode != 0 :
7
8
print (f"Command failed: { command } \n Error: { result .stderr } " )
8
9
return result
9
10
10
- def update_repo (repo , script , plugin_type = 'readme' ):
11
+ def update_repo (repo , order , plugin_type = 'readme' ):
11
12
print (f"Updating { repo } ..." )
12
13
current_dir = os .getcwd ()
13
14
repo_path = os .path .join (current_dir , 'github' , repo )
@@ -22,16 +23,28 @@ def update_repo(repo, script, plugin_type='readme'):
22
23
run_command (f'git clone https://github.com/sccn/{ repo } .git { repo_path } ' )
23
24
24
25
os .chdir (current_dir )
25
- run_command (f'python { script } { repo_path } { repo } { plugin_type } ' )
26
+ script = 'reformat_plugin.py'
27
+ command = f'python { script } { repo_path } { repo } { plugin_type } { order } '
28
+ run_command (command )
26
29
27
30
if __name__ == "__main__" :
28
31
# if 'github' not in current directory, create it
29
32
if not os .path .exists ('github' ):
30
33
os .makedirs ('github' )
31
-
32
- # wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
33
- # for plugin in wiki_plugins:
34
- # update_repo(plugin, "reformat_plugin.py", 'wiki')
35
- readme_plugins = ['ARfitStudio' ] #, 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
36
- for plugin in readme_plugins :
37
- update_repo (plugin , "reformat_plugin.py" , "readme" )
34
+ if len (sys .argv ) == 0 :
35
+ order = 1
36
+ wiki_plugins = ['SIFT' , 'get_chanlocs' , 'NFT' , 'PACT' , 'nsgportal' , 'clean_rawdata' ]
37
+ for plugin in wiki_plugins :
38
+ update_repo (plugin , order , 'wiki' )
39
+ order += 1
40
+ readme_plugins = ['ARfitStudio' , 'roiconnect' , 'EEG-BIDS' , 'trimOutlier' , 'groupSIFT' , 'nwbio' , 'ICLabel' , 'dipfit' , 'eegstats' , 'PowPowCAT' , 'PACTools' , 'zapline-plus' , 'amica' , 'fMRIb' , 'relica' , 'std_dipoleDensity' , 'imat' , 'viewprops' , 'cleanline' ,'NIMA' , 'firfilt' ]
41
+ for plugin in readme_plugins :
42
+ update_repo (plugin , order , "readme" )
43
+ order += 1
44
+ elif len (sys .argv ) == 3 :
45
+ plugin_name = sys .argv [1 ]
46
+ plugin_type = sys .argv [2 ]
47
+ update_repo (plugin_name , 1 , plugin_type )
48
+ else :
49
+ print ('Usage: python update_plugins.py <plugin_name> <plugin_type>' )
50
+ sys .exit (1 )
0 commit comments