Skip to content

Commit

Permalink
Enable the manual dist missing workaround
Browse files Browse the repository at this point in the history
- I suddenly remember that pyinstaller also has this potential issue so
  this might fix that, i.e. when the hook to collect data files for the
  package metadata isn't included, something like the following might be
  usable:

  ```
  from PyInstaller.utils.hooks import collect_data_files, copy_metadata

  datas = []
  datas.extend(collect_data_files("ply"))
  datas.extend(copy_metadata("ply"))
  datas.extend(collect_data_files("calmjs.parse"))
  datas.extend(copy_metadata("calmjs.parse"))
  ```

  Naturally, the pre-generated modules must already be present before
  they can be collected.

- This might fix the issue as reported by the user of yet another non-
  standard Python environment in #42.
  • Loading branch information
metatoaster committed Oct 28, 2023
1 parent abb6ea8 commit 3536a1e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/calmjs/parse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
from pkg_resources import Requirement
ply_dist = working_set.find(Requirement.parse('ply'))
# note that for **extremely** ancient versions of setuptools, e.g.
# setuptools<0.6c11, will require the following workaround...
# if ply_dist is None:
# from pkg_resources import Distribution
# import ply
# ply_dist = Distribution(project_name='ply', version=ply.__version__)
# setuptools<0.6c11, or some very non-standard environment that does
# not include the required metadata (e.g. pyinstaller without the
# required metadata), will require the following workaround...
if ply_dist is None: # pragma: no cover
from pkg_resources import Distribution
import ply
ply_dist = Distribution(project_name='ply', version=ply.__version__)
except ImportError: # pragma: no cover
ply_dist = None

Expand Down

0 comments on commit 3536a1e

Please sign in to comment.