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 like so:

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

  data = collect_data_files("calmjs.parse")
  data.extend(copy_metadata("calmjs.parse"))
  ```

- 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 723218c
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 723218c

Please sign in to comment.