Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: remove the --profile option from the build command #1137

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions lektor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from lektor.cli_utils import validate_language
from lektor.compat import importlib_metadata as metadata
from lektor.project import Project
from lektor.utils import profile_func
from lektor.utils import secure_url


Expand Down Expand Up @@ -90,7 +89,6 @@ def cli(ctx, project=None, language=None):
"`.lektor` inside the output path.",
)
@extraflag
@click.option("--profile", is_flag=True, help="Enable build profiler.")
@pass_context
def build_cmd(
ctx,
Expand All @@ -100,7 +98,6 @@ def build_cmd(
verbosity,
source_info_only,
buildstate_path,
profile,
extra_flags,
):
"""Builds the entire project into the final artifacts.
Expand Down Expand Up @@ -152,10 +149,7 @@ def build_cmd(
builder.update_all_source_infos()
success = True
else:
if profile:
failures = profile_func(builder.build_all)
else:
failures = builder.build_all()
failures = builder.build_all()
if prune:
builder.prune()
success = failures == 0
Expand Down
18 changes: 0 additions & 18 deletions lektor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,24 +664,6 @@ def get_relative_path(source, target):
raise AssertionError("This should not happen")


def profile_func(func):
# pylint: disable=import-outside-toplevel

from cProfile import Profile
from pstats import Stats

p = Profile()
rv = []
p.runcall(lambda: rv.append(func()))
p.dump_stats("/tmp/lektor-%s.prof" % func.__name__)

stats = Stats(p, stream=sys.stderr)
stats.sort_stats("time", "calls")
stats.print_stats()

return rv[0]


def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
Expand Down