Skip to content

flit_core does not filter out Python bytecode when not operating on vcs #568

@nanonyme

Description

@nanonyme

When flit_core is generating allowed files into sdist

def select_files(self):
"""Pick which files from the source tree will be included in the sdist
This is overridden in flit itself to use information from a VCS to
include tests, docs, etc. for a 'gold standard' sdist.
"""
cfgdir_s = str(self.cfgdir)
return [
osp.relpath(p, cfgdir_s) for p in self.module.iter_files()
] + self.extra_files
it does not use

flit/flit/sdist.py

Lines 98 to 101 in ec6e6b7

def include_path(p):
return not (p.startswith('dist' + os.sep)
or (os.sep+'__pycache__' in p)
or p.endswith('.pyc'))
for filtering on output files which results in Python bytecode ending up in package. Looks like there is filtering done through
def _include(path):
name = os.path.basename(path)
if (name == '__pycache__') or name.endswith('.pyc'):
return False
return True
but it appears not to cover all cases. This is almost certainly undesired behaviour as there is no portability with Python bytecode across other Python versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions