Skip to content

Commit 8ef145f

Browse files
committed
fix MSBuildDeps sep
1 parent 627b80e commit 8ef145f

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

conan/tools/microsoft/msbuilddeps.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
VALID_LIB_EXTENSIONS = (".so", ".lib", ".a", ".dylib", ".bc")
1616

1717

18-
class MSBuildDeps(object):
18+
class MSBuildDeps:
1919
"""
2020
MSBuildDeps class generator
2121
conandeps.props: unconditional import of all *direct* dependencies only
@@ -167,7 +167,7 @@ def escape_path(path):
167167
# https://docs.microsoft.com/en-us/visualstudio/msbuild/
168168
# how-to-escape-special-characters-in-msbuild
169169
# https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-special-characters
170-
return path.replace("\\", "/").lstrip("/")
170+
return path.lstrip("/")
171171

172172
def join_paths(paths):
173173
# TODO: ALmost copied from CMakeDeps TargetDataContext

test/integration/toolchains/microsoft/test_msbuilddeps.py

+12-18
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ def generate(self):
6161
ms.platform = self.options.platform
6262
ms.generate()
6363
""")
64-
64+
6565
# Remove custom set of keys to test default values
6666
app = app.replace(f'ms.configuration_key = "{config_key}"', "") if config_key is None else app
6767
app = app.replace(f'ms.platform_key = "{platform_key}"', "") if platform_key is None else app
6868
config_key_expected = "Configuration" if config_key is None else config_key
6969
platform_key_expected = "Platform" if platform_key is None else platform_key
70-
71-
client.save({"app/conanfile.py": app,
70+
71+
client.save({"app/conanfile.py": app,
7272
"lib/conanfile.py": GenConanfile("lib", "0.1").with_package_type("header-library")})
7373
client.run("create lib")
7474
client.run(f'install app -s build_type={build_type} -s arch={arch} -o *:platform={exp_platform} -o *:configuration="{configuration}"')
@@ -181,18 +181,12 @@ def package_info(self):
181181
def test_msbuilddeps_relocatable(withdepl):
182182
c = TestClient()
183183
c.save({
184-
"libh/conanfile.py": GenConanfile("libh", "0.1")
185-
.with_package_type("header-library"),
186-
"libs/conanfile.py": GenConanfile("libs", "0.2")
187-
.with_package_type("static-library")
188-
.with_requires("libh/0.1"),
189-
"libd/conanfile.py": GenConanfile("libd", "0.3")
190-
.with_package_type("shared-library"),
191-
"app/conanfile.py": GenConanfile()
192-
.with_requires("libh/0.1")
193-
.with_requires("libs/0.2")
194-
.with_requires("libd/0.3")
195-
.with_settings("arch", "build_type"),
184+
"libh/conanfile.py": GenConanfile("libh", "0.1").with_package_type("header-library"),
185+
"libs/conanfile.py": GenConanfile("libs", "0.2").with_package_type("static-library")
186+
.with_requires("libh/0.1"),
187+
"libd/conanfile.py": GenConanfile("libd", "0.3").with_package_type("shared-library"),
188+
"app/conanfile.py": GenConanfile().with_requires("libh/0.1", "libs/0.2", "libd/0.3")
189+
.with_settings("arch", "build_type"),
196190
})
197191

198192
c.run("create libh")
@@ -206,7 +200,7 @@ def test_msbuilddeps_relocatable(withdepl):
206200
value = text.split(f"<{marker}>")[1].split(f"</{marker}>")[0]
207201
if withdepl:
208202
# path should be relative, since artifacts are moved along with project
209-
prefix = '$(MSBuildThisFileDirectory)/'
203+
prefix = '$(MSBuildThisFileDirectory)\\'
210204
assert value.startswith(prefix)
211205
tail = value[len(prefix):]
212206
assert not os.path.isabs(tail)
@@ -222,5 +216,5 @@ def test_msbuilddeps_relocatable(withdepl):
222216
for fn in propsfiles:
223217
text = c.load(fn)
224218
text = text.replace('\\', '/')
225-
dir = c.current_folder.replace('\\', '/')
226-
assert dir not in text
219+
folder = c.current_folder.replace('\\', '/')
220+
assert folder not in text

0 commit comments

Comments
 (0)