зеркало из https://github.com/mozilla/pjs.git
Bug 675123 - move config.json into virtualenv, a=testonly, DONTBUILD
This commit is contained in:
Родитель
da5f2e8b5b
Коммит
0737ea3b18
|
@ -55,13 +55,27 @@ fi
|
||||||
|
|
||||||
# install TPS
|
# install TPS
|
||||||
cd ${CWD}
|
cd ${CWD}
|
||||||
python setup.py develop
|
python setup.py install
|
||||||
|
|
||||||
if [ "$?" -gt 0 ]
|
if [ "$?" -gt 0 ]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CONFIG="`find ${VIRTUAL_ENV} -name config.json.in`"
|
||||||
|
NEWCONFIG=${CONFIG:0:${#CONFIG}-3}
|
||||||
|
|
||||||
|
cd "../../services/sync/tests/tps"
|
||||||
|
TESTDIR="`pwd`"
|
||||||
|
|
||||||
|
cd "../../tps"
|
||||||
|
EXTDIR="`pwd`"
|
||||||
|
|
||||||
|
sed 's|__TESTDIR__|'"${TESTDIR}"'|' "${CONFIG}" | sed 's|__EXTENSIONDIR__|'"${EXTDIR}"'|' > "${NEWCONFIG}"
|
||||||
|
rm ${CONFIG}
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "***********************************************************************"
|
||||||
echo
|
echo
|
||||||
echo "To run TPS, activate the virtualenv using:"
|
echo "To run TPS, activate the virtualenv using:"
|
||||||
echo " source ${TARGET}/${BIN_NAME}"
|
echo " source ${TARGET}/${BIN_NAME}"
|
||||||
|
@ -69,3 +83,8 @@ echo "then execute tps using:"
|
||||||
echo " runtps --binary=/path/to/firefox"
|
echo " runtps --binary=/path/to/firefox"
|
||||||
echo
|
echo
|
||||||
echo "See runtps --help for all options"
|
echo "See runtps --help for all options"
|
||||||
|
echo
|
||||||
|
echo "To change your TPS config, please edit the file: "
|
||||||
|
echo "${NEWCONFIG}"
|
||||||
|
echo
|
||||||
|
echo "***********************************************************************"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
To edit the TPS configuration, do not edit config.json.in in the tree.
|
||||||
|
Instead, edit config.json inside your virtualenv; it will be located at
|
||||||
|
something like:
|
||||||
|
|
||||||
|
(linux): /path/to/virtualenv/lib/python2.6/site-packages/tps-0.2.40-py2.6.egg/tps/config.json
|
||||||
|
(win): /path/to/virtualenv/Lib/site-packages/tps-0.2.40-py2.6.egg/tps/config.json
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
},
|
},
|
||||||
"platform": "win32",
|
"platform": "win32",
|
||||||
"os": "win7",
|
"os": "win7",
|
||||||
"es": "localhost:9200"
|
"es": "localhost:9200",
|
||||||
|
"testdir": "__TESTDIR__",
|
||||||
|
"extensiondir": "__EXTENSIONDIR__"
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ setup(name='tps',
|
||||||
keywords='',
|
keywords='',
|
||||||
author='Jonathan Griffin',
|
author='Jonathan Griffin',
|
||||||
author_email='jgriffin@mozilla.com',
|
author_email='jgriffin@mozilla.com',
|
||||||
url='http://hg.mozilla.org/services/tps',
|
url='http://hg.mozilla.org/services/services-central',
|
||||||
license='MPL',
|
license='MPL',
|
||||||
dependency_links = [
|
dependency_links = [
|
||||||
"http://people.mozilla.org/~jgriffin/packages/"
|
"http://people.mozilla.org/~jgriffin/packages/"
|
||||||
|
@ -72,4 +72,7 @@ setup(name='tps',
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
runtps = tps.cli:main
|
runtps = tps.cli:main
|
||||||
""",
|
""",
|
||||||
|
data_files=[
|
||||||
|
('tps', ['config/config.json.in']),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
import json
|
import json
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
|
@ -76,7 +77,7 @@ def main():
|
||||||
"will be searched;")
|
"will be searched;")
|
||||||
parser.add_option("--configfile",
|
parser.add_option("--configfile",
|
||||||
action = "store", type = "string", dest = "configfile",
|
action = "store", type = "string", dest = "configfile",
|
||||||
default = "config.json",
|
default = None,
|
||||||
help = "path to the config file to use "
|
help = "path to the config file to use "
|
||||||
"[default: %default]")
|
"[default: %default]")
|
||||||
parser.add_option("--pulsefile",
|
parser.add_option("--pulsefile",
|
||||||
|
@ -86,15 +87,33 @@ def main():
|
||||||
"json format that you want to inject into the monitor")
|
"json format that you want to inject into the monitor")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
configfile = options.configfile
|
||||||
|
if configfile is None:
|
||||||
|
if os.environ.get('VIRTUAL_ENV'):
|
||||||
|
configfile = os.path.join(os.path.dirname(__file__), 'config.json')
|
||||||
|
else:
|
||||||
|
raise Exception("Unable to find config.json in a VIRTUAL_ENV; you must "
|
||||||
|
"specify a config file using the --configfile option")
|
||||||
|
|
||||||
# load the config file
|
# load the config file
|
||||||
f = open(options.configfile, 'r')
|
f = open(configfile, 'r')
|
||||||
configcontent = f.read()
|
configcontent = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
config = json.loads(configcontent)
|
config = json.loads(configcontent)
|
||||||
|
|
||||||
rlock = RLock()
|
rlock = RLock()
|
||||||
|
|
||||||
extensionDir = os.path.join(os.getcwd(), "..", "..", "services", "sync", "tps")
|
extensionDir = config.get("extensiondir")
|
||||||
|
if not extensionDir or extensionDir == '__EXTENSIONDIR__':
|
||||||
|
extensionDir = os.path.join(os.getcwd(), "..", "..", "services", "sync", "tps")
|
||||||
|
else:
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
# replace msys-style paths with proper Windows paths
|
||||||
|
import re
|
||||||
|
m = re.match('^\/\w\/', extensionDir)
|
||||||
|
if m:
|
||||||
|
extensionDir = "%s:/%s" % (m.group(0)[1:2], extensionDir[3:])
|
||||||
|
extensionDir = extensionDir.replace("/", "\\")
|
||||||
|
|
||||||
if options.binary is None:
|
if options.binary is None:
|
||||||
# If no binary is specified, start the pulse build monitor, and wait
|
# If no binary is specified, start the pulse build monitor, and wait
|
||||||
|
|
Загрузка…
Ссылка в новой задаче