Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/variables.py @ 33:3ee21f868440
Implement a "posixpath" filter to convert file path strings to use forward slashes.
Needed for Mako configuration.
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Mon, 21 Mar 2016 13:49:05 +0100 |
| parents | d70b58b0dfb9 |
| children | 0e9f1f875ab0 |
comparison
equal
deleted
inserted
replaced
| 32:6faddf796623 | 33:3ee21f868440 |
|---|---|
| 6 from __future__ import division, absolute_import, print_function | 6 from __future__ import division, absolute_import, print_function |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 from functools import wraps | 9 from functools import wraps |
| 10 | 10 |
| 11 from .compat import PY2, text_to_native_os_str, native_os_str_to_text | 11 from .compat import PY2, text_to_native_os_str, native_os_str_to_text, u |
| 12 | 12 |
| 13 | 13 |
| 14 __all__ = [] | 14 __all__ = [] |
| 15 | 15 |
| 16 | 16 |
| 112 | 112 |
| 113 | 113 |
| 114 @filter("abspath") | 114 @filter("abspath") |
| 115 def abspath_impl(config, v): | 115 def abspath_impl(config, v): |
| 116 return os.path.abspath(v) | 116 return os.path.abspath(v) |
| 117 | |
| 118 | |
| 119 @filter("posixpath") | |
| 120 def posixpath_impl(config, v): | |
| 121 return v.replace(u('\\'), u('/')) |
