Skip to content

Commit

Permalink
fix: compatibility with pdm 2.3 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Dec 12, 2022
1 parent 57c150a commit 4134b5d
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 90 deletions.
1 change: 1 addition & 0 deletions news/24.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the code compatibility with `pdm 2.3.0+`.
124 changes: 51 additions & 73 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package-dir = "src"
dev = [
"pytest>=6.1",
"towncrier~=19.2",
"pdm>=2.0",
"pdm>=2.3",
"parver>=0.3"
]

Expand Down
4 changes: 2 additions & 2 deletions src/pdm_packer/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _write_zipapp(
if options.output:
output = options.output
else:
name = project.meta.name or project.root.name
name = project.name or project.root.name
name = name.replace("-", "_")
suffix = ".pyz" if not options.exe else ".exe" if os.name == "nt" else ""
output = Path(name + suffix)
Expand Down Expand Up @@ -107,7 +107,7 @@ def file_filter(name: str) -> bool:
if options.main:
main = options.main
else:
scripts = project.meta.get("scripts", {})
scripts = project.pyproject.metadata.get("scripts", {})
if scripts:
main = str(scripts[next(iter(scripts))])

Expand Down
4 changes: 2 additions & 2 deletions src/pdm_packer/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from typing import Any

from pdm.cli.actions import resolve_candidates_from_lockfile
from pdm.compat import cached_property
from pdm.models.environment import Environment
from pdm.project import Project
from pdm.utils import cached_property

IN_PROCESS_SCRIPT = Path(__file__).with_name("_compile_source.py")

Expand Down Expand Up @@ -41,7 +41,7 @@ def prepare_lib_for_pack(self, compile: bool = False) -> Path:
requirements = project.get_dependencies().values()
candidates = resolve_candidates_from_lockfile(project, requirements)
synchronizer = project.core.synchronizer_class(
candidates, self, install_self=bool(project.meta.name), no_editable=True
candidates, self, install_self=bool(project.name), no_editable=True
)
synchronizer.synchronize()
dest = Path(this_paths["purelib"])
Expand Down
Loading

0 comments on commit 4134b5d

Please sign in to comment.