Skip to content

Commit 991e980

Browse files
committed
move hash_port.py to tools/
also remove log_tests.ini that seems to be unused, there's no CHANGES top level either Change-Id: I4ce48e253fe93c331f6ce6d94b4e7532dff495a5
1 parent 2163179 commit 991e980

File tree

4 files changed

+28
-64
lines changed

4 files changed

+28
-64
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ recursive-include docs *.html *.css *.txt *.js *.jpg *.png *.py Makefile *.rst *
22
recursive-include tests *.py *.dat *.crt *.pem *.key *.sh
33
recursive-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

77
prune docs/build/output
88

hash_port.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

log_tests.ini

Lines changed: 0 additions & 34 deletions
This file was deleted.

tools/hash_port.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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)

0 commit comments

Comments
 (0)