File tree Expand file tree Collapse file tree 4 files changed +28
-64
lines changed
Expand file tree Collapse file tree 4 files changed +28
-64
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ recursive-include docs *.html *.css *.txt *.js *.jpg *.png *.py Makefile *.rst *
22recursive-include tests *.py *.dat *.crt *.pem *.key *.sh
33recursive-include tools *.py
44
5- include README* LICENSE CHANGES* log_tests.ini tox.ini hash_port.py noxfile.py
5+ include README* LICENSE tox.ini noxfile.py
66
77prune docs/build/output
88
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ """
2+ Helper script which provides an integer number from a given range based on a
3+ hash of current directory name.
4+
5+ This is used in continuous integration as a helper to provide ports to assign
6+ to services like Redis, Memcached when they are run on a per-test basis.
7+
8+ E.g. in a Jenkins job, one could put as the run command::
9+
10+ export TOX_DOGPILE_PORT=`python tools/hash_port.py 10000 34000`
11+ nox -v -t ${pyv}-${backend}
12+
13+ So you'd get one TOX_DOGPILE_PORT for the script in
14+ /var/lib/jenkins-workspace/py27-redis, another TOX_DOGPILE_PORT for the script
15+ in /var/lib/jenkins-workspace/py34-memcached. nox (as well as the previous tox
16+ setup) calls the pifpaf tool to run redis/ memcached local to that build and
17+ has it listen on this port.
18+ """
19+
20+ import os
21+ import sys
22+
23+ start , end = int (sys .argv [1 ]), int (sys .argv [2 ])
24+
25+ dir_ = os .getcwd ()
26+
27+ print ((hash (dir_ ) % (end - start )) + start )
You can’t perform that action at this time.
0 commit comments