ostree: introduce optional subpath feature
This commit is contained in:
parent
bd316ddb8f
commit
3bb5bedd8e
3 changed files with 49 additions and 8 deletions
|
|
@ -4,8 +4,10 @@ network related utilities
|
|||
"""
|
||||
import contextlib
|
||||
import http.server
|
||||
import os
|
||||
import socket
|
||||
import ssl
|
||||
import sys
|
||||
import threading
|
||||
|
||||
try:
|
||||
|
|
@ -25,6 +27,12 @@ except ImportError:
|
|||
from .atomic import AtomicCounter
|
||||
|
||||
|
||||
def print_dir(directory):
|
||||
for root, _, files in os.walk(directory):
|
||||
for fn in files:
|
||||
print(os.path.join(root, fn))
|
||||
|
||||
|
||||
def _get_free_port():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind(("localhost", 0))
|
||||
|
|
@ -47,6 +55,8 @@ class SilentHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
class DirHTTPServer(ThreadingHTTPServer):
|
||||
def __init__(self, *args, directory=None, simulate_failures=0, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
print("Serving:", file=sys.stderr)
|
||||
print_dir(directory)
|
||||
self.directory = directory
|
||||
self.simulate_failures = AtomicCounter(simulate_failures)
|
||||
self.reqs = AtomicCounter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue