Skip to Content
Scope: Python projects

Description

The getPythonPath task resolves the python path of an eclipse project. This task reads and parses the python related project artefacts in order to access these pathes. The pythonpath can be resolved to ant's path type or to a string property. The pythonpath can be resolved in a relative (to the given workspace) or absolute manner. In case the pythonpath is resolved to a path type, it can be referenced using the ref-id attribute wherever a pythonpath must be used.

Arguments

The getPythonPath task provides the following arguments:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectName Name of the eclipse project yes
property The name of the property that will hold the resolved path either 'pathId' or 'property' has to be specified
pathId The reference id for the path that will be created either 'pathId' or 'property' has to be specified
pathSeparator The system-dependent path-separator character. This character is used to separate filenames in a sequence of files. no (default: On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';')
dirSeparator The system-dependent default name-separator character. no (default: On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\')
relative Determines whether the result path should be resolved relative to the given workspace or absolute no (default: false)
ignoreruntime Boolean value that determines whether a runtime has to be set or not. If set to true you must register a python runtime first. no (default: false)

Example usage

The following example resolves the pythonpath of the project simple.python.project to the property pythonpath. All entries are separated by the default path separator (as defined in java.io.File.separator). You can use the pathSeparator attribute to explicitly specify a character that is used to separate the entries of the pythonpath:

  <ant4eclipse:getPythonPath 
    workspaceDirectory="${workspace}"
    projectName="simple.python.project"
    property="pythonpath"
    ignoreruntime="true"
    pathSeparator=";"
  />

You can also export a pythonpath to an ant path:

  <ant4eclipse:getPythonPath 
    pathId="pythonpath"
    workspaceDirectory="${workspace}"
    ignoreruntime="true"
    projectName="simple.python.project" 
  />

You can use the relative attribute to request a pythonpath that consists of path entries relative to the specified workspace:

  <ant4eclipse:getPythonPath 
    property="pythonpath"
    workspaceDirectory="${workspace}"
    projectName="myProject"
    pathSeparator=";"
    ignoreruntime="true"
    relative="true"
  />