| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 14 # | 14 # |
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
| 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
| 18 import sys, os, re, errno, codecs, logging | 18 import sys |
| 19 from ..utils import process_page | 19 import os |
| 20 from ..sources import MercurialSource | 20 import re |
| 21 import errno |
| 22 import codecs |
| 23 import logging |
| 24 |
| 25 from cms.utils import process_page |
| 26 from cms.sources import MercurialSource |
| 21 | 27 |
| 22 def memoize(func): | 28 def memoize(func): |
| 23 memoized = {} | 29 memoized = {} |
| 24 def wrapper(*args): | 30 def wrapper(*args): |
| 25 try: | 31 try: |
| 26 return memoized[args] | 32 return memoized[args] |
| 27 except KeyError: | 33 except KeyError: |
| 28 return memoized.setdefault(args, func(*args)) | 34 return memoized.setdefault(args, func(*args)) |
| 29 return wrapper | 35 return wrapper |
| 30 | 36 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 os.rmdir(path) | 106 os.rmdir(path) |
| 101 remove_unknown(output_dir) | 107 remove_unknown(output_dir) |
| 102 | 108 |
| 103 if __name__ == "__main__": | 109 if __name__ == "__main__": |
| 104 if len(sys.argv) < 3: | 110 if len(sys.argv) < 3: |
| 105 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] | 111 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] |
| 106 sys.exit(1) | 112 sys.exit(1) |
| 107 | 113 |
| 108 repo, output_dir = sys.argv[1:3] | 114 repo, output_dir = sys.argv[1:3] |
| 109 generate_pages(repo, output_dir) | 115 generate_pages(repo, output_dir) |
| OLD | NEW |