Skip to content

Commit

Permalink
git subrepo pull (merge) subrepos/transom
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "subrepos/transom"
  merged:   "16132fe"
upstream:
  origin:   "[email protected]:ssorj/transom.git"
  branch:   "main"
  commit:   "5b0e3a4"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"
  • Loading branch information
ssorj committed Jan 1, 2024
1 parent 9b9d266 commit 66b046c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 30 deletions.
2 changes: 1 addition & 1 deletion subrepos/transom/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:ssorj/transom.git
branch = main
commit = 6f9a3639e63f98487db0da2ca98a8b656571261c
commit = 5b0e3a4b40c63a11386ee1da4190f2356c597d5f
parent = 86555d2ab4da3285aff13bcb920b26f6a5fdf7d1
method = merge
cmdver = 0.4.6
7 changes: 6 additions & 1 deletion subrepos/transom/python/transom/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ def transom_init():
transom_command.main(["init", "--init-only"])

with working_dir():
transom_command.main(["init"])
transom_command.main(["init", "--github", "--verbose"])

check_dir("config")
check_dir("input")
check_file("config/config.py")
check_file("input/index.md")
check_file("input/main.css")
check_file("input/main.js")
check_file(".plano.py")
check_file(".nojekyll")
check_dir("python/mistune")
check_dir("python/transom")

transom_command.main(["init"]) # Re-init

Expand All @@ -90,6 +94,7 @@ def transom_render():
check_file("output/test-2.html")
check_file("output/main.css")
check_file("output/main.js")
check_file("output/steamboat.png")

result = read("output/index.html")
assert "<title>Doorjamb</title>" in result, result
Expand Down
4 changes: 2 additions & 2 deletions subrepos/transom/subrepos/plano/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:ssorj/plano.git
branch = main
commit = 32e229ecfaecac444ad72f58f7d2d17cd4b66f84
parent = a2787ee677f112f73f04389302d3cdae6cfc5146
commit = bf353496626d3ee6996b5f9c8dfb0213f7b894fe
parent = 6f9a3639e63f98487db0da2ca98a8b656571261c
method = merge
cmdver = 0.4.6
9 changes: 9 additions & 0 deletions subrepos/transom/subrepos/plano/src/plano/_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,15 @@ def logging_operations():
with logging_disabled():
error("Yikes")

with expect_output(contains="flipper") as out:
with logging_enabled(output=out):
with logging_context("flipper"):
notice("Whhat")

with logging_context("bip"):
with logging_context("boop"):
error("It's alarming!")

@test
def path_operations():
abspath = _os.path.abspath
Expand Down
14 changes: 6 additions & 8 deletions subrepos/transom/subrepos/plano/src/plano/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ def __call__(self, *args, **kwargs):

app.running_commands.append(self)

dashes = "--" * len(app.running_commands)
dashes = "----" * (len(app.running_commands) - 1)
display_args = list(self._get_display_args(args, kwargs))

with console_color("magenta", file=_sys.stderr):
eprint("{}> {}".format(dashes, self.name), end="")
eprint("{}--> {}".format(dashes, self.name), end="")

if display_args:
eprint(" ({})".format(", ".join(display_args)), end="")
Expand All @@ -432,14 +432,12 @@ def __call__(self, *args, **kwargs):

self.function(*args, **kwargs)

cprint("<{} {}".format(dashes, self.name), color="magenta", file=_sys.stderr)
if dashes:
dashes = dashes[:-1] + " "

app.running_commands.pop()

if app.running_commands:
name = app.running_commands[-1].name
cprint("{}<-- {}".format(dashes, self.name), color="magenta", file=_sys.stderr)

cprint("{}| {}".format(dashes[:-2], name), color="magenta", file=_sys.stderr)
app.running_commands.pop()

def _get_display_args(self, args, kwargs):
for i, param in enumerate(self.parameters.values()):
Expand Down
59 changes: 41 additions & 18 deletions subrepos/transom/subrepos/plano/src/plano/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def pprint(*args, **kwargs):
"magenta": "\u001b[35",
"cyan": "\u001b[36",
"white": "\u001b[37",
"gray": "\u001b[90",
}

_color_reset = "\u001b[0m"
Expand Down Expand Up @@ -414,7 +415,7 @@ def check_env(var, message=None):
def check_module(module, message=None):
if _pkgutil.find_loader(module) is None:
if message is None:
message = "Module {} is not found".format(repr(module))
message = "Python module {} is not found".format(repr(module))

raise PlanoError(message)

Expand Down Expand Up @@ -806,6 +807,7 @@ def read_link(path):

_logging_output = None
_logging_threshold = _NOTICE
_logging_contexts = list()

def enable_logging(level="notice", output=None):
assert level in _logging_levels
Expand Down Expand Up @@ -851,6 +853,16 @@ class logging_disabled(logging_enabled):
def __init__(self):
super().__init__(level="disabled")

class logging_context:
def __init__(self, name):
self.name = name

def __enter__(self):
_logging_contexts.append(self.name)

def __exit__(self, exc_type, exc_value, traceback):
_logging_contexts.pop()

def fail(message, *args):
error(message, *args)

Expand Down Expand Up @@ -882,28 +894,39 @@ def log(level, message, *args):
_print_message(level, message, args)

def _print_message(level, message, args):
line = list()
out = nvl(_logging_output, _sys.stderr)
exception = None

line.append(cformat("{}:".format(get_program_name()), color="gray"))

level_color = ("cyan", "cyan", "cyan", "yellow", "red", None)[level]
level_bright = (False, False, False, False, True, False)[level]
level_text = "{}:".format(_logging_levels[level])

line.append(cformat(level_text, color=level_color, bright=level_bright))

for name in _logging_contexts:
line.append(cformat("{}:".format(name), color="yellow"))

if isinstance(message, BaseException):
exception = message
message = "{}: {}".format(type(message).__name__, str(message))
else:
message = str(message)

if args:
message = message.format(*args)
line.append(type(exception).__name__)
line.append(str(exception))

program = "{}:".format(get_program_name())
print(" ".join(line), file=out)

level_color = ("cyan", "cyan", "blue", "yellow", "red", None)[level]
level_bright = (False, False, False, False, True, False)[level]
level = cformat("{:>6}:".format(_logging_levels[level]), color=level_color, bright=level_bright, file=out)
if hasattr(exception, "__traceback__"):
_traceback.print_exception(type(exception), exception, exception.__traceback__, file=out)
else:
message = str(message)

if args:
message = message.format(*args)

print(program, level, capitalize(message), file=out)
line.append(capitalize(message))

if exception is not None and hasattr(exception, "__traceback__"):
_traceback.print_exception(type(exception), exception, exception.__traceback__, file=out)
print(" ".join(line), file=out)

out.flush()

Expand Down Expand Up @@ -1648,7 +1671,7 @@ def __repr__(self):
## YAML operations

def read_yaml(file):
check_module("yaml", "To install it, run 'pip install pyyaml'")
check_module("yaml", "Python module 'yaml' is not found. To install it, run 'pip install pyyaml'.")

import yaml as _yaml

Expand All @@ -1658,7 +1681,7 @@ def read_yaml(file):
return _yaml.safe_load(f)

def write_yaml(file, data):
check_module("yaml", "To install it, run 'pip install pyyaml'")
check_module("yaml", "Python module 'yaml' is not found. To install it, run 'pip install pyyaml'.")

import yaml as _yaml

Expand All @@ -1672,14 +1695,14 @@ def write_yaml(file, data):
return file

def parse_yaml(yaml):
check_module("yaml", "To install it, run 'pip install pyyaml'")
check_module("yaml", "Python module 'yaml' is not found. To install it, run 'pip install pyyaml'.")

import yaml as _yaml

return _yaml.safe_load(yaml)

def emit_yaml(data):
check_module("yaml", "To install it, run 'pip install pyyaml'")
check_module("yaml", "Python module 'yaml' is not found. To install it, run 'pip install pyyaml'.")

import yaml as _yaml

Expand Down
Binary file added subrepos/transom/test-site/input/steamboat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 66b046c

Please sign in to comment.