Question about pyc handling in conda-build

0 views
Skip to first unread message

Matthieu Dartiailh

unread,
Jun 30, 2017, 8:37:24 AM6/30/17
to conda - Public
Hi,

I have a question about how relocation is handled in pyc files because I have similar cache files for a project (Enaml), that are also generated by marshaling a code object. As far as I read in conda-build sources, pyc files not generated by setup.py are compiled manually by calling py_compile (is this True or all files are recompiled ?). Using that procedure, I do not see how the reference to the build path is removed to make those files relocatable. In my use case, the build_prefix is identified in the marshaled files and replaced but after install marshal find the file to be corrupted. Are pyc files relocatable ? I suppose they are as otherwise __file__ would not contain the proper path.

After some hours of struggling, I ended simply not generating those cache files but I would really like to be able to include them.
Does anybody can give me pointer about how I could handle this case ?

Thanks

Matthieu Dartiailh

Matthieu Dartiailh

unread,
Jul 1, 2017, 5:16:29 PM7/1/17
to conda - Public
I made some progress by duplicating the CPython logic in importing files and setting the co_filename after loading the cache files. My issue now is that I simply need to specify to conda to ignore those files. I tried to set ignore_prefix_files but I cannot get the glob pattern right to catch all files. Ideally I would like to get all files with a single pattern. Furthermore I seem to have a similar issue with skip_pyc_compiling on both conda-build 2.1.16 and master branch.

Could any body give some pointers about how to get it right ?

Best,

Matthieu Dartiailh

Michael Sarahan

unread,
Jul 1, 2017, 5:40:19 PM7/1/17
to Matthieu Dartiailh, conda - Public
I have never needed to do anything special for pyc files, but it seems like your marshaling is not common practice.

You may be able to get conda-build to replace the prefix for you if you list files in the binary_has_prefix_files key: https://conda.io/docs/building/meta-yaml.html#binary-has-prefix-files - but I'm not sure why this wouldn't already be working, from the sound of it.

--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@continuum.io.
To post to this group, send email to co...@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/70eda1c3-33f4-4451-9d9b-1ca0b1428009%40continuum.io.

Michael Sarahan

unread,
Jul 1, 2017, 5:53:42 PM7/1/17
to Matthieu Dartiailh, conda - Public
Please keep replies on list.  Your message was:

----------------------------------------------------------------
As explained in my other message, I found why pyc do not need that kind of treatment and now I would like conda just to ignore my cache files. I cannot get the ignore_prefix_files right so that it ignores all files ending in .enamlc.
Could you give me some pointers ?
-----------------------------------------------------------------

If conda-build's current glob pattern support is insufficient, please file an issue, or better yet, a PR.  This issue may be related: https://github.com/conda/conda-build/issues/1730

My timeline for adding such a feature is probably 1-2 months right now.  If you put a PR in, I'll review it much more quickly.
Reply all
Reply to author
Forward
0 new messages