简体   繁体   中英

PySys. pysysproject.xml: How to build <path> nodes relying on properties' values

In my pysysproject.xml some properties are defined that reference some paths in my project, in a similar way that those shown below:

...
<property name="path1" value="/dir1/dir2/dirA" /> 
<property name="path2" value="/dir1/dir2/dirB" /> 
<property name="path3" value="/dir1/dir2/dirC" /> 
...

At the end of my file, we also include some <path> nodes to provide the Python interpreter additional directories for searching for modules. That looks like similar to

<path value="./dir1/dir2/dirA/module1" relative="true"/>
<path value="./dir1/dir2/dirB/module2" relative="true"/>
<path value="./dir1/dir2/dirC/module3" relative="true"/>

where the base directories for module1 , module2 and module3 correspond to the values provided for the path1 , path2 and path3 properties respectively...

What I'd like to know if there is a way of using these properties when setting these paths, like:

<path value="./${path1}/module1" relative="true" />
<path value="./${path2}/module2" relative="true" />
<path value="./${path3}/module3" relative="true" />

I've tried this way before but, Unfortunately, it didn't work... The contents of the Python's sys.path object I get was

[ OTHER_DIRS, u'C:\\MSM\\tests\\${path1}\\Module1', u'C:\\MSM\\tests\\${path2}\\Module2', u'C:\\MSM\\tests\\${path3}\\Module3']

that shows that the properties were not replaced by their contents in the way we'd like (the following ouput is the "expected" one):

[ OTHER_DIRS, u'C:\\MSM\\tests\\dir1\\dir2\\dirA\\Module1', u'C:\\MSM\\tests\\dir1\\dir2\\dirB\\Module2', u'C:\\MSM\\\\dir1\\dir2\\dirC\\Module3']

Any feedback about that will be appreciated...

Unfortunately this isn't supported at the moment. We do expand environment variables into the path element, but not previously defined properties as defined in the project file. I will add a feature request and implement in the next release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM