Skip to content

Commit

Permalink
fix .pth file inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed May 19, 2023
1 parent a5d9c28 commit 4c2cd13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Expand Up @@ -3,4 +3,3 @@ graft jupyter-config

include LICENSE
include pyproject.toml
include reactpy_jupyter.pth
2 changes: 1 addition & 1 deletion reactpy_jupyter/__init__.py
Expand Up @@ -10,7 +10,7 @@
from .monkey_patch import execute_patch
from .widget_component import from_widget

__version__ = "0.9.1" # DO NOT MODIFY
__version__ = "0.9.2" # DO NOT MODIFY

__all__ = (
"from_widget",
Expand Down
12 changes: 12 additions & 0 deletions setup.py
Expand Up @@ -161,6 +161,17 @@ def build_javascript_first(cmd: Command):
log.info("Successfully installed Javascript")


def build_with_pth_file(cmd: Command):
build_lib = getattr(cmd, "build_lib", None) or getattr(cmd, "dist_dir", None)
if build_lib is None:
raise ValueError("Cannot find build_lib or dist_dir")

pth_filename = f"{NAME}.pth"
source_pth_file = ROOT_DIR / pth_filename
target_pth_file = Path(build_lib, pth_filename)
cmd.copy_file(str(source_pth_file), str(target_pth_file))


def add_to_cmd(cls: Command, functions: list[Callable[[Command], None]]) -> Command:
class Command(cls):
def run(self):
Expand All @@ -175,6 +186,7 @@ def run(self):
add_to_cmd,
functions=[
build_javascript_first,
build_with_pth_file,
],
)

Expand Down

0 comments on commit 4c2cd13

Please sign in to comment.