Skip to content

Multiple workspace

multiple_workspace

This file is required to make Python interpreter treat the directory as a containing package.

File is slightly modified from Edk2 BaseTools/Source/Python/Common/MultipleWorkspace.py

MultipleWorkspace

This class manages multiple workspace behavior.

Attributes:

Name Type Description
WORKSPACE str

defined the current workspace

PACKAGES_PATH str

defined the other WORKSPACE

convertPackagePath classmethod

convertPackagePath(Ws: str, Path: str) -> str

Convert path to match workspace.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
Ws str

The current WORKSPACE

required
Path str

Path to be converted to match workspace

required

Returns:

Type Description
str

Converted path.

setWs classmethod

setWs(
    Ws: str, PackagesPath: Optional[list[str]] = None
) -> None

Set WORKSPACE and PACKAGES_PATH environment.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
Ws str

initialize WORKSPACE variable

required
PackagesPath str

initialize PackagesPath variable

None

join classmethod

join(Ws: str, *p: str) -> str

Rewrite os.path.join.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
Ws str

the current WORKSPACE

required
*p str

path of the inf/dec/dsc/fdf/conf file

()

Returns:

Type Description
str

absolute path of the specified file

relpath classmethod

relpath(Path: str, Ws: str) -> str

Rewrite os.path.relpath.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
Path str

path of the inf/dec/dsc/fdf/conf file

required
Ws str

the current WORKSPACE

required

Returns:

Type Description
str

the relative path of specified file

getWs classmethod

getWs(Ws: str, Path: str) -> str

Get valid workspace for the path.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
Ws str

the current WORKSPACE

required
Path str

path of the inf/dec/dsc/fdf/conf file

required

Returns:

Type Description
str

valid workspace relative to the specified file path

handleWsMacro classmethod

handleWsMacro(PathStr: str) -> str

Handle the $(WORKSPACE) tag.

If current workspace is an invalid path relative to the tool, replace it.

Parameters:

Name Type Description Default
cls MultipleWorkspace

The class pointer

required
PathStr str

The path string

required

Returns:

Type Description
Str

Path string including the $(WORKSPACE)

getPkgPath classmethod

getPkgPath() -> list[str]

Get all package paths.

Parameters:

Name Type Description Default
cls MultipleWorkspace

class pointer

required

Returns:

Type Description
list[str]

Packages Path