MCPcopy Index your code
hub / github.com/reactive-python/reactpy / main

Function main

docs/docs_app/dev.py:61–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59
60
61def main():
62 # Mostly copied from https://github.com/executablebooks/sphinx-autobuild/blob/b54fb08afc5112bfcda1d844a700c5a20cd6ba5e/src/sphinx_autobuild/cli.py
63 parser = get_parser()
64 args = parser.parse_args()
65
66 srcdir = os.path.realpath(args.sourcedir)
67 outdir = os.path.realpath(args.outdir)
68 if not os.path.exists(outdir):
69 os.makedirs(outdir)
70
71 server = Server()
72
73 build_args, pre_build_commands = _get_build_args(args)
74 builder = wrap_builder(
75 get_builder(
76 server.watcher,
77 build_args,
78 host=args.host,
79 port=args.port,
80 pre_build_commands=pre_build_commands,
81 )
82 )
83
84 ignore_handler = _get_ignore_handler(args)
85 server.watch(srcdir, builder, ignore=ignore_handler)
86 for dirpath in args.additional_watched_dirs:
87 real_dirpath = os.path.realpath(dirpath)
88 server.watch(real_dirpath, builder, ignore=ignore_handler)
89 server.watch(outdir, ignore=ignore_handler)
90
91 if not args.no_initial_build:
92 builder()
93
94 # Find the free port
95 portn = args.port or find_free_port()
96 if args.openbrowser is True:
97
98 def opener():
99 time.sleep(args.delay)
100 webbrowser.open(f"http://{args.host}:{args.port}/index.html")
101
102 threading.Thread(target=opener, daemon=True).start()
103
104 server.serve(port=portn, host=args.host, root=outdir)

Callers

nothing calls this directly

Calls 1

wrap_builderFunction · 0.85

Tested by

no test coverage detected