A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

25 lines
842 B

  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import subprocess
  5. def process(program, old_file, new_file):
  6. print "%s: %s -> %s" % (program, old_file, new_file)
  7. content = subprocess.check_output([program, old_file])
  8. with open(new_file, "w") as fp:
  9. fp.write(content)
  10. def main():
  11. root = os.path.join(os.path.dirname(__file__), "static")
  12. for dirpath, dirnames, filenames in os.walk(root):
  13. for filename in filenames:
  14. name = os.path.join(dirpath, filename)
  15. if filename.endswith(".js") and ".min." not in filename:
  16. process("uglifyjs", name, name.replace(".js", ".min.js"))
  17. if filename.endswith(".css") and ".min." not in filename:
  18. process("uglifycss", name, name.replace(".css", ".min.css"))
  19. if __name__ == "__main__":
  20. main()