Skip to content

Commit b194dcc

Browse files
committed
More unwinding of looking up external hostnames. Correct pid kill behaviour. Add PyPI index option to makefile
1 parent fcc4312 commit b194dcc

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ EXTRA_DEPS = setuptools-git \
1717

1818
COPY_FILES = VERSION CHANGES.md common_setup.py MANIFEST.in LICENSE
1919
UPLOAD_OPTS =
20+
PYPI_INDEX =
21+
22+
PIP_INSTALL_ARGS := $(shell [ ! -z "${PYPI_INDEX}" ] && echo --index ${PYPI_INDEX} )
2023

2124
# removed from PHONY: circleci_sip circleci_pyqt
2225
.PHONY: extras copyfiles wheels eggs sdists install develop test upload clean
2326

2427
extras:
25-
pip install $(EXTRA_DEPS)
28+
pip install ${PIP_INSTALL_ARGS} ${EXTRA_DEPS}
2629

2730
copyfiles:
28-
./foreach.sh 'for file in $(COPY_FILES); do cp ../$$file .; done'
31+
./foreach.sh 'for file in ${COPY_FILES}; do cp ../$$file .; done'
2932

3033
wheels: copyfiles
31-
pip install -U wheel
34+
pip install ${PIP_INSTALL_ARGS} -U wheel
3235
./foreach.sh --changed 'python setup.py bdist_wheel'
3336

3437
eggs: copyfiles
@@ -38,12 +41,12 @@ sdists: copyfiles
3841
./foreach.sh --changed 'python setup.py sdist'
3942

4043
install: copyfiles
41-
pip install -U wheel
44+
pip install ${PIP_INSTALL_ARGS} -U wheel
4245
./foreach.sh 'python setup.py bdist_wheel'
43-
./foreach.sh 'pip install dist/*.whl'
46+
./foreach.sh 'pip install ${PIP_INSTALL_ARGS} dist/*.whl'
4447

4548
develop: copyfiles extras
46-
./foreach.sh 'pip install -e.[tests]'
49+
./foreach.sh 'pip install ${PIP_INSTALL_ARGS} -e.[tests]'
4750

4851
test:
4952
rm -f FAILED-*

pytest-pyramid-server/pytest_pyramid_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def pre_setup(self):
112112
except configparser.NoOptionError:
113113
parser.set('app:main', 'url_prefix', '')
114114

115-
# Set the uri to be the external hostname and the url prefix
116-
self._uri = "http://%s:%s/%s" % (os.uname()[1], self.port, parser.get('app:main', 'url_prefix'))
115+
# Set the uri to be the hostname and the url prefix
116+
self._uri = "http://%s:%s/%s" % (self.hostname, self.port, parser.get('app:main', 'url_prefix'))
117117

118118
@property
119119
def run_cmd(self):

pytest-server-fixtures/pytest_server_fixtures/httpd.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ def pre_setup(self):
159159

160160
@property
161161
def pid(self):
162-
return int((self.workspace / 'run' / 'httpd.pid').read_text())
162+
try:
163+
return int((self.workspace / 'run' / 'httpd.pid').read_text())
164+
except FileNotFoundError:
165+
return None
163166

164167
@property
165168
def run_cmd(self):
166169
return [CONFIG.httpd_executable, '-f', self.config]
167170

168171
def kill(self, retries=5):
169-
self.kill_by_pid(self.pid, retries)
172+
pid = self.pid
173+
if pid is not None:
174+
self.kill_by_pid(self.pid, retries)

0 commit comments

Comments
 (0)