indygreg / PyOxidizer

A modern Python application packaging and distribution tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a configuration that does not depend on the absolute path?

maBarabas opened this issue · comments

I'm trying to use glob to add some files to my output, but it seems to require knowing the absolute path of the project root as an argument to strip_prefix.

error[TUGGER_FILE_RESOURCE]: path cannot be absolute: C:/Users/barabas/Documents/project-name/./binaries/app.bin
       --> .\pyoxidizer.bzl:289:16
        |
    289 |     binaries = glob(["binaries/*"])
        |                ^^^^^^^^^^^^^^^^^^^^ glob()

How can this error be resolved without hardcoding strip_prefix to C:/Users/barabas/Documents/project-name/ which will only work on my machine.

This is the same issue as #410, which was closed without a real solution.

Why does the solution given in #410 to use glob(["binaries/*"], strip_prefix=CWD) not work for you? The behavior could be argued to be intended as how would a glob know where to chop off the paths otherwise.

I had assumed they meant the actual current working directory rather than the magic CWD constant. This should work.