def main(argv): """main""" verbose = script_utils.has_verbose_flag(argv) manage_dir = script_utils.manage_py_dir() manage_py = script_utils.manage_py_command() # Ensure dump_dir/ exists, creating it if not found. dump_dir = os.path.dirname(manage_dir + "dumped_data" + os.sep) if not os.path.exists(dump_dir): if verbose: print "Creating " + dump_dir os.makedirs(dump_dir) #Loop through all state_types, dump the data, then write it out. for state_pair in state_pairs: command = "python " + manage_py + " dumpdata --indent=2 " + state_pair[0] if verbose: print command (status, output) = commands.getstatusoutput(command) if status: print "Error obtaining " + state_pair[0] + " skipping. (" + output + ")" else: output_file = os.path.join(dump_dir, state_pair[1] + ".json") print "Writing " + output_file with open(output_file, "w") as out: out.write(output)
def main(argv): """main""" verbose = script_utils.has_verbose_flag(argv) # get full path to the directory with manage.py in it. manage_dir = script_utils.manage_py_dir() manage_py = script_utils.manage_py_command() command = "coverage erase" if verbose: print command os.system(command) command = "python " + manage_py + " clean_pyc" if verbose: print command os.system(command) command = "coverage run --source=" + manage_dir + "apps " + manage_py + " test" if verbose: print command os.system(command) command = "coverage html" if verbose: print command os.system(command)
def main(argv): """main""" verbose = script_utils.has_verbose_flag(argv) manage_dir = script_utils.manage_py_dir() manage_py = script_utils.manage_py_command() # Ensure dump_dir/ exists, creating it if not found. dump_dir = os.path.dirname(manage_dir + "dumped_data" + os.sep) if not os.path.exists(dump_dir): if verbose: print "Creating " + dump_dir os.makedirs(dump_dir) #Loop through all state_types, dump the data, then write it out. for state_pair in state_pairs: command = "python " + manage_py + " dumpdata --indent=2 " + state_pair[ 0] if verbose: print command (status, output) = commands.getstatusoutput(command) if status: print "Error obtaining " + state_pair[ 0] + " skipping. (" + output + ")" else: output_file = os.path.join(dump_dir, state_pair[1] + ".json") print "Writing " + output_file with open(output_file, "w") as out: out.write(output)
def main(argv): """Compile Less main function. Usage: compile_less.py [-v | --verbose]""" verbose = script_utils.has_verbose_flag(argv) page_names = ['landing', 'status', 'admin'] less_path = script_utils.manage_py_dir() + "static/less" os.chdir(less_path) theme_names = glob.glob('theme-*.less') for theme in theme_names: theme_name, _ = os.path.splitext(theme) if verbose: print "Compiling %s.less" % theme_name os.system("lessc -x --yui-compress %s.less > ../css/%s.css" % (theme_name, theme_name)) for page in page_names: if verbose: print "Compiling %s.less" % page os.system("lessc -x --yui-compress %s.less > ../css/%s.css" % (page, page))
def main(argv): """Verify main function. Usage: verify.py [-v | --verbose]""" current_dir = os.getcwd() manage_dir = script_utils.manage_py_dir() manage_py = script_utils.manage_py_command() verbose = script_utils.has_verbose_flag(argv) if verbose: print "running pep8" pep8_command = os.path.join("scripts", "run_pep8.sh") status = os.system("cd " + manage_dir + "; " + pep8_command) if status: sys.exit(1) if verbose: print "running pylint" pylint_command = os.path.join("scripts", "run_pylint.sh") status = os.system("cd " + manage_dir + "; " + pylint_command) if status: sys.exit(1) if verbose: print "cleaning" os.system("python " + manage_py + " clean_pyc") if verbose: print "running tests" status = os.system("python " + manage_py + " test") if status: sys.exit(1) if verbose: print "building docs" status = os.system("cd " + manage_dir + "; " + "cd ../doc; make clean html; cd " + current_dir) if status: sys.exit(1)