Index: trunk/tools/editor_trends/config.py |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | |
45 | 45 | config.read('wiki.cfg') |
46 | 46 | settings.working_directory = config.get('file_locations', 'working_directory') |
47 | | - settings.input_location = config.get('file_locations', 'xml_file_location') |
| 47 | + settings.input_location = config.get('file_locations', 'settings.input_location') |
48 | 48 | |
49 | 49 | |
50 | 50 | def create_configuration(**kwargs): |
Index: trunk/tools/editor_trends/configuration.py |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | self.encoding = 'utf-8' |
50 | 50 | self.date_format = '%Y-%m-%d' #Date format as used by Erik Zachte |
51 | 51 | self.timestamp_format = '%Y-%m-%dT%H:%M:%SZ' # Timestampformat as generated by the MediaWiki dumps |
52 | | - |
| 52 | + |
53 | 53 | self.max_settings_xmlfile_size = 67108864 # ==64Mb, see http://hadoop.apache.org/common/docs/r0.20.0/hdfs_design.html#Large+Data+Setsfor reason |
54 | 54 | self.number_of_processes = cpu_count() * process_multiplier |
55 | 55 | #Change this to match your computers configuration (RAM / CPU) |
— | — | @@ -62,15 +62,15 @@ |
63 | 63 | self.architecture = platform.machine() |
64 | 64 | self.working_directory = self.determine_working_directory() |
65 | 65 | self.update_python_path() |
66 | | - |
| 66 | + |
67 | 67 | self.root = '/' if self.platform != 'Windows' else 'c:\\' |
68 | 68 | self.ziptool = self.determine_ziptool() |
69 | 69 | self.file_locations = self.set_file_locations() |
70 | 70 | self.max_filehandles = self.determine_max_filehandles_open() |
71 | | - |
72 | | - self.windows_register= {'7zip': 'Software\\7-Zip',} |
73 | 71 | |
74 | | - self.projects= {'commons': 'commonswiki', |
| 72 | + self.windows_register = {'7zip': 'Software\\7-Zip', } |
| 73 | + |
| 74 | + self.projects = {'commons': 'commonswiki', |
75 | 75 | 'wikibooks': 'wikibooks', |
76 | 76 | 'wikinews': 'wikinews', |
77 | 77 | 'wikiquote': 'wikiquote', |
— | — | @@ -88,24 +88,21 @@ |
89 | 89 | 'multilingual wikisource': None |
90 | 90 | } |
91 | 91 | |
92 | | - |
| 92 | + |
93 | 93 | def determine_working_directory(self): |
94 | 94 | cwd = os.getcwd() |
95 | 95 | if not cwd.endswith('editor_trends%s' % os.sep): |
96 | 96 | pos = cwd.find('editor_trends') + 14 |
97 | 97 | cwd = cwd[:pos] |
98 | 98 | return cwd |
99 | | - |
| 99 | + |
100 | 100 | def determine_platform(self): |
101 | | - #Setting up the environment |
102 | | - ops = {platform.win32_ver: 'Windows', |
103 | | - platform.linux_distribution: 'Linux', |
104 | | - platform.mac_ver: 'OSX'} |
105 | | - for op in ops: |
106 | | - if op() != ('', '', '') and op() != ('', ('', '', ''), ''): |
107 | | - return ops[op] |
108 | | - return None |
109 | | - |
| 101 | + os = platform.system() |
| 102 | + if os == 'Darwin': |
| 103 | + return 'OSX' |
| 104 | + else: |
| 105 | + return os |
| 106 | + |
110 | 107 | def verify_environment(self, directories): |
111 | 108 | for dir in directories: |
112 | 109 | result = os.path.exists(dir) |
— | — | @@ -114,7 +111,7 @@ |
115 | 112 | os.mkdir(dir) |
116 | 113 | except IOError: |
117 | 114 | raise 'Configuration Error, could not create directory.' |
118 | | - |
| 115 | + |
119 | 116 | def detect_windows_program(self, program): |
120 | 117 | entry = self.windows_register[program] |
121 | 118 | try: |
— | — | @@ -130,7 +127,7 @@ |
131 | 128 | return path |
132 | 129 | else: |
133 | 130 | raise NotImplementedError |
134 | | - |
| 131 | + |
135 | 132 | def determine_max_filehandles_open(self): |
136 | 133 | if self.platform == 'Windows' and self.architecture == 'i386': |
137 | 134 | return win32file._getmaxstdio() |