support cx_freeze
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 419
- PR merge metrics
- No merged PRs in 30d
Description
Hi I had a problem when use pygal with cx_freeze. I noticed in svg.py or utils.py, there are many codes related to access resource files like css or worldmap.svg like:
css = os.path.join(os.path.dirname(**file**), 'css', css)
the problem is when cx_freeze freeze the whole app, all dependencies will be packed into a single library.zip. os.path.join(os.path.dirname(**file**)) will give sth like xxx/library.zip/pygal/css/base.css which is an invalid path (library.zip is not a directory).
My work around is to use os.getcwd() instead and copy resource files.
Is it possible to provide a method to configure the path in Config class or sth like that? Thanks.
BTW: I just realized I could use zipfile.ZipFile to read files in a zip file and it worked; however We still need to modify the code quite a bit.
Contributor guide
Research direction
Start by reading svg.py and utils.py, especially the resource paths for CSS and worldmap.svg. Reproduce the issue with cx_Freeze and inspect the suggested zipfile.ZipFile approach. Done means pygal can access its packaged resources from library.zip without requiring substantial user-side code changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100