Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/export case insensitive #8585

Merged
merged 7 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conans/client/cmd/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def export_source(conanfile, origin_folder, destination_source_folder):
included_sources, excluded_sources = _classify_patterns(conanfile.exports_sources)
copier = FileCopier([origin_folder], destination_source_folder)
for pattern in included_sources:
copier(pattern, links=True, excludes=excluded_sources)
copier(pattern, links=True, excludes=excluded_sources, ignore_case=False)
output = conanfile.output
package_output = ScopedOutput("%s exports_sources" % output.scope, output)
copier.report(package_output)
Expand Down Expand Up @@ -494,7 +494,7 @@ def export_recipe(conanfile, origin_folder, destination_folder):

copier = FileCopier([origin_folder], destination_folder)
for pattern in included_exports:
copier(pattern, links=True, excludes=excluded_exports)
copier(pattern, links=True, excludes=excluded_exports, ignore_case=False)
copier.report(package_output)

_run_method(conanfile, "export", origin_folder, destination_folder, output)
Expand Down
31 changes: 31 additions & 0 deletions conans/test/functional/command/export/export_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import stat
import textwrap
import unittest
Expand Down Expand Up @@ -462,3 +463,33 @@ def test_export_conflict_no_user_channel(self):
self.assertIn("pkg/0.1: A new conanfile.py version was exported", client.out)
client.run('export . Pkg/0.1@', assert_error=True)
self.assertIn("ERROR: Cannot export package with same name but different case", client.out)


@pytest.mark.skipif(platform.system() != "Linux", reason="Needs case-sensitive filesystem")
def test_export_casing():
# https://github.com/conan-io/conan/issues/8583
client = TestClient()
conanfile = textwrap.dedent("""
from conans import ConanFile
class Pkg(ConanFile):
exports = "file1", "FILE1"
exports_sources = "test", "TEST"
""")
client.save({"conanfile.py": conanfile,
"test": "some lowercase",
"TEST": "some UPPERCASE",
"file1": "file1 lowercase",
"FILE1": "file1 UPPERCASE"
})
assert client.load("test") == "some lowercase"
assert client.load("TEST") == "some UPPERCASE"
assert client.load("file1") == "file1 lowercase"
assert client.load("FILE1") == "file1 UPPERCASE"
client.run("export . pkg/0.1@")
ref = ConanFileReference.loads("pkg/0.1@")
export_src_folder = client.cache.package_layout(ref).export_sources()
assert load(os.path.join(export_src_folder, "test")) == "some lowercase"
assert load(os.path.join(export_src_folder, "TEST")) == "some UPPERCASE"
exports_folder = client.cache.package_layout(ref).export()
assert load(os.path.join(exports_folder, "file1")) == "file1 lowercase"
assert load(os.path.join(exports_folder, "FILE1")) == "file1 UPPERCASE"