summaryrefslogtreecommitdiff
path: root/scripts/ac_source_server
blob: 9bd82b03015bb8c0b71ffa630c0e058b9711b2e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python

# A minimal Web server to provide local source tarballs to AstroConda package
# builds, using the same hostname alias ("astroconda-source") across sites.
#
# To get this working:
# - Define an "astroconda-source" alias for the host where the local tarballs
#   are located.
# - Start this script in the directory containing the source tarballs.
#
# The original SSL version also required these things, but I've reverted to
# using plain HTTP for now, commenting out the SSL bits:
# - Place an SSL certificate file, "astroconda.pem", in the same directory as
#   the source tarballs.
# - Point each client build machine to a copy of an SSL certificate store:
#       conda config --set ssl_verify /path/to/file.crt (not properly tested)
#    or conda config --set ssl_verify false (less safe)

import BaseHTTPServer
import SimpleHTTPServer
# import ssl

# It seems common practice to use port 4443 for unprivileged HTTPS services but
# 4440 is unassigned and less likely to conflict with any other HTTPS service:
port=4440

httpd = BaseHTTPServer.HTTPServer(
    ('', port), SimpleHTTPServer.SimpleHTTPRequestHandler
)

# httpd.socket = ssl.wrap_socket(
#     httpd.socket,
#     certfile='astroconda.pem',    # cert. kept in CWD with source tarballs
#     server_side=True
# )

httpd.serve_forever()