Skip to content

Dereference directory symlink in src/main/python/ #768

Closed

Description

@hoxu

Adding symlinks to files under src/main/python dereferences the files.

How to add a directory symlink in src/main/python and deference it so that the directory it points to gets included? It seems by default directory symlinks under src/main/python are simply ignored.

Activity

  1. hoxu commented on Feb 11, 2021

    @hoxu
    ContributorAuthor

    Further digging revealed that symlinked directories are dereferenced properly, and copied to target/dist/$name/.

    However, setup.py -v clean --all bdist_wheel does not include the copied files in the tarball, because they are not included in packages or py_modules.

    This appears to be a bug in pybuilder: it seems to dereference directory symlinks when copying the files, but not when generating packages/py_modules.

    Relevant source code is probably pybuilder.plugins.python.core_plugin.{list_packages,list_modules}:

    def list_packages(project):
    source_path = project.expand_path("$" + PYTHON_SOURCES_PROPERTY)
    result = []
    for root, dirs, files in walk(source_path):
    if "__init__.py" in files:
    result.append(relpath(root, source_path).replace(sep, "."))
    return sorted(result)
    def list_modules(project):
    source_path = project.expand_path("$" + PYTHON_SOURCES_PROPERTY)
    result = []
    for potential_module_file in listdir(source_path):
    potential_module_path = np(jp(source_path, potential_module_file))
    if isfile(potential_module_path) and potential_module_file.endswith(".py"):
    result.append(potential_module_file[:-3])
    return sorted(result)

    os.walk defaults to followlinks=False.

  2. added 7 commits that reference this issue on Sep 12, 2021
    5203aec
    9c4113b
    3bd7b18
    83eaef4
    80885d1
    b14e842
    618512b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions