http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84634
Revision: 84634
Author: diederik
Date: 2011-03-23 21:39:17 +0000 (Wed, 23 Mar 2011)
Log Message:
-----------
Made some minor changes that allow you to install Wikilytics in any location.
Modified Paths:
--------------
trunk/tools/editor_trends/__init__.py
trunk/tools/editor_trends/classes/settings.py
trunk/tools/editor_trends/requirements.txt
Modified: trunk/tools/editor_trends/__init__.py
===================================================================
--- trunk/tools/editor_trends/__init__.py 2011-03-23 21:38:31 UTC (rev
84633)
+++ trunk/tools/editor_trends/__init__.py 2011-03-23 21:39:17 UTC (rev
84634)
@@ -1,30 +0,0 @@
-import os
-import sys
-
-from classes import singleton
-
-class Path:
- __metaclass__ = singleton.Singleton
-
- def __init__(self):
- self.cwd = self.determine_working_directory()
- self.update_python_path()
-
- def determine_working_directory(self):
- cwd = os.getcwd()
- if not cwd.endswith('editor_trends%s' % os.sep):
- pos = cwd.find('editor_trends') + 14
- cwd = cwd[:pos]
- return cwd
-
- def update_python_path(self):
- IGNORE_DIRS = ['wikistats', 'zips', 'datasets', 'mapreduce', 'logs',
- 'statistics', 'js_scripts', 'deployment',
- 'documentation', 'data', 'code-snippets']
- dirs = [name for name in os.listdir(self.cwd) if
- os.path.isdir(os.path.join(self.cwd, name))]
- for subdirname in dirs:
- if not subdirname.startswith('.') and subdirname not in
IGNORE_DIRS:
- sys.path.append(os.path.join(self.cwd, subdirname))
-
-Path()
Modified: trunk/tools/editor_trends/classes/settings.py
===================================================================
--- trunk/tools/editor_trends/classes/settings.py 2011-03-23 21:38:31 UTC
(rev 84633)
+++ trunk/tools/editor_trends/classes/settings.py 2011-03-23 21:39:17 UTC
(rev 84634)
@@ -118,16 +118,27 @@
else:
return False
+
def determine_working_directory(self):
cwd = os.getcwd()
- if not cwd.endswith('editor_trends%s' % os.sep):
- pos = cwd.find('editor_trends') + 14
+ slashes = cwd.count(os.sep)
+ paths = []
+ paths.append(cwd)
+ while slashes >0 :
+ pos = cwd.rfind(os.sep)
cwd = cwd[:pos]
- return cwd
+ if cwd != '':
+ paths.append(cwd)
+ slashes -=1
+ for cwd in paths:
+ for root, dirs, files in os.walk(cwd, topdown=True):
+ if os.path.exists(os.path.join(root, 'manage.py')):
+ return root
+
+ raise 'I could not determine the location of manage.py, please
reinstall Wikilytics.'
def detect_python_version(self):
version = sys.version_info[0:2]
- #logger.debug('Python version: %s' % '.'.join(str(version)))
if version < self.minimum_python_version:
raise exceptions.OutDatedPythonVersionError
Modified: trunk/tools/editor_trends/requirements.txt
===================================================================
--- trunk/tools/editor_trends/requirements.txt 2011-03-23 21:38:31 UTC (rev
84633)
+++ trunk/tools/editor_trends/requirements.txt 2011-03-23 21:39:17 UTC (rev
84634)
@@ -1,6 +1,4 @@
progressbar==2.3-dev
-psyco==1.6
-pywin32==214
pymongo==1.9
argparse
python-dateutil
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs