1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | # This helper script is used with the 'test-desert-island' Makefile target. |
---|
4 | |
---|
5 | |
---|
6 | import sys |
---|
7 | |
---|
8 | good = True |
---|
9 | build_out = sys.argv[1] |
---|
10 | mode = sys.argv[2] |
---|
11 | |
---|
12 | print() |
---|
13 | |
---|
14 | for line in open(build_out, "r"): |
---|
15 | if mode == "no-downloads": |
---|
16 | # when setup_requires= uses |
---|
17 | # misc/dependencies/setuptools-0.6c8.egg, it causes a |
---|
18 | # "Downloading: misc/dependencies/.." line to be emitted, |
---|
19 | # which doesn't count as a network download. Lines that start |
---|
20 | # with "Reading" indicate that it is fetching web pages in |
---|
21 | # order to check for newer versions of packages. As long as it |
---|
22 | # doesn't actually download any packages then it still passes |
---|
23 | # this test. That is: it *would* have succeeded if you were on |
---|
24 | # a Desert Island, an airplane with no network, behind a |
---|
25 | # corporate firewall that disallows such connections, or if |
---|
26 | # you had turned off your network prior to running "python |
---|
27 | # setup.py build". A stronger requirement would be that it |
---|
28 | # doesn't even try to check for new packages on remote hosts |
---|
29 | # if it has all the packages that it needs locally, but we |
---|
30 | # currently don't enforce that stronger requirement. |
---|
31 | if (line.startswith("Downloading http:") or |
---|
32 | line.startswith("Downloading https:")): |
---|
33 | print(line, end=' ') |
---|
34 | good = False |
---|
35 | if good: |
---|
36 | if mode == "no-downloads": |
---|
37 | print("Good: build did not try to download any files") |
---|
38 | sys.exit(0) |
---|
39 | else: |
---|
40 | if mode == "no-downloads": |
---|
41 | print("Failed: build tried to download files") |
---|
42 | sys.exit(1) |
---|