import subprocess, os #subprocess.run(["ls", "-l"]) dirpath = '/var/www/html/moodle' #dirpath = '/home/camilo/Projects/DINTEV/TEST' #blocks blocks = ['/blocks/', 'git clone --branch master https://github.com/desarrolloant/course_list.git course_list', 'git clone --branch master https://github.com/jonof/moodle-block_completion_progress.git completion_progress', 'git clone --branch MOODLE_36_STABLE https://github.com/jleyva/moodle-block_configurablereports.git configurable_reports', 'git clone --branch dev https://github.com/marxjohnson/moodle-block_messageteacher.git messageteacher', 'git clone --branch master https://github.com/deraadt/moodle-block_simple_clock.git simple_clock', ] #Mod mod = [ '/mod/', 'git clone --branch main https://github.com/danmarsden/moodle-mod_attendance.git attendance', 'git clone --branch MOODLE_38_STABLE https://github.com/davosmith/moodle-checklist.git checklist', 'git clone --branch master https://github.com/ndunand/moodle-mod_choicegroup.git choicegroup', 'git clone --branch MOODLE_20_STABLE https://github.com/bdaloukas/moodle-mod_game.git game', 'git clone --branch MOODLE_38_STABLE https://github.com/projectestac/moodle-mod_geogebra.git geogebra', 'git clone --branch master https://github.com/gbateson/moodle-mod_hotpot.git hotpot', 'git clone --branch master https://github.com/elearningsoftware/moodle-mod_journal.git journal', 'git clone --branch master https://github.com/netspotau/moodle-mod_lightboxgallery.git lightboxgallery', 'git clone --branch MOODLE_39_STABLE https://github.com/PoetOS/moodle-mod_questionnaire.git questionnaire', 'git clone --branch master https://github.com/lucaboesch/moodle-quizaccess_safeexambrowser.git /quiz/safeexambrowser' ] lib = [ '/lib/editor/', 'git clone --branch master https://github.com/dthies/moodle-atto_cloze.git /atto/plugins/cloze', 'git clone --branch master https://github.com/dthies/moodle-atto_fullscreen.git /atto/plugins/fullscreen', 'git clone --branch master https://github.com/moodle-ead/atto_justify.git /atto/plugins/justify', 'git clone --branch master https://github.com/ndunand/moodle-atto_morebackcolors.git /atto/plugins/morebackcolors', 'git clone --branch master https://github.com/ndunand/moodle-atto_morefontcolors.git /atto/plugins/morefontcolors', 'git clone --branch stable https://github.com/wiris/moodle-atto_wiris.git /atto/plugins/wiris', 'git clone --branch v3.8r03 https://github.com/germanvaleroelizondo/moodle-tinymce_clozeeditor.git /tinymce/plugins/clozeeditor', ] course = [ '/course/format/', 'git clone --branch MOODLE_33 https://github.com/davidherney/moodle-format_onetopic.git onetopic', 'git clone --branch master https://github.com/brandaorodrigo/moodle-format_buttons.git buttons', ] question = [ '/question/type/', 'git clone --branch master https://github.com/ethz-let/moodle-qtype_kprime.git kprime'] filter = [ '/filter/', 'git clone --branch master https://github.com/wiris/moodle-filter_wiris.git wiris'] local = [ '/local/', 'git clone --branch master https://github.com/desarrolloant/deleteoldcourses.git deleteoldcourses'] commnads = [blocks, mod,lib, course, question, filter, local] def get_command(array): localpath = dirpath + array.pop(0) while array: com = array.pop(0).split() com.append(localpath + com.pop()) subprocess.Popen(com) def executor(): os.system( 'git clone --branch stable https://github.com/h5p/moodle-mod_hvp.git {}/mod/hvp'.format(dirpath)) os.system( 'cd {}/mod/hvp && git submodule update --init'.format(dirpath)) while(commnads): get_command(commnads.pop()) executor() print('DONE\n')