question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] scm field replacement indentation mismatch

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: Windows 10
  • Compiler+version: N/A
  • Conan version: 1.48.1
  • Python version: (inbuilt)

Steps to reproduce (Include if Applicable)

Create a super conanfile froma python requires:

from conans import ConanFile

class BaseConanFile(object):
	url = "auto"
	scm = {
		"type": "git",
		"url": "auto",
		"revision": "auto",
		"submodule": "recursive",
	}

class Package(ConanFile):
	name = "base-conanfile"
	version = "0.1.0"

Use that python requires from a separate repo/conanfile:

from conans import ConanFile

required_conan_version = ">=1.42.0"

class Package(ConanFile):
	name = "snip-pkg"
	python_requires = "base-conanfile/0.1.0"
	python_requires_extend = "base-conanfile.BaseConanFile"

Derive from that base conanfile, have the python file use tab indentation instead of spaces, then conan create it, an error will be output.

Logs

...snip...
ERROR: snip-pkg/1.1.1-alpha.3+git.f6f8a82@local/test: Cannot load recipe.
Error loading conanfile at 'D:\.conan\.conan\data\snip-pkg\1.1.1-alpha.3+git.f6f8a82\local\test\export\conanfile
.py': Unable to load conanfile in D:\.conan\.conan\data\snip-pkg\1.1.1-alpha.3+git.f6f8a82\local\test\export\con
anfile.py
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\.conan\.conan\data\snip-pkg\1.1.1-alpha.3+git.f6f8a82\local\test\export\conanfile.py", line 10
    name = "snip-pkg"
                    ^
TabError: inconsistent use of tabs and spaces in indentation

Resulting recipe with mismatched indentation:

from conans import ConanFile

required_conan_version = ">=1.42.0"

class Package(ConanFile):
 scm = {"revision": "f6f8a8266fc28195ac06b83ae5caa47c2b11b635",
           "submodule": "recursive",
           "type": "git",
           "url": "ssh://git@snipsnip.git"}
	name = "snip-pkg"
	python_requires = "base-conanfile/0.1.0"
	python_requires_extend = "base-conanfile.BaseConanFile"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
memshardedcommented, Sep 7, 2022

Yes, at this stage, with alternative better solutions, this will not be fixed, and fortunately and as recommended in the docs, it seems that most users have started to use the scm_to_conandata. Closing it, thanks for the feedback!

1reaction
memshardedcommented, Sep 6, 2022

Hi @AshleighAdams

It seems you are using a deprecated legacy feature. The first inmediate/easy workaround is to define: conan config set general.scm_to_conandata=1 (better, put it into your conan.conf). That makes Conan to put the scm information in conandata.yml instead of modifying the source code of conanfile.py on the fly. This has been the recommended approach for a long time.

But if you really want to modernize your recipe and be Conan 2.0 ready, you need to drop the scm attribute, and use this approach instead: https://docs.conan.io/en/latest/reference/conanfile/tools/scm/git.html#example-implementing-the-scm-feature

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indentation Mismatch error - Lemma Soft Forums
I keep getting an error called "Indentation Mismatch" that occurs on the same line as my 'Return' code. Bare in mind this is...
Read more >
FFMpeg Indentation Mismatch betwen AEM and FFMpeg
Thus AEM FFMpegWrapper ( cq-dam-video 5.12.8 ) fails to obtain the necessary details and the transcoding process does not even start, breaking ...
Read more >
3 Common Tasks — The Yocto Project ® 4.1.999 documentation
During the build process, BitBake displays an error on starting if it detects a .bbappend file that does not have a corresponding recipe...
Read more >
Change log : linux-gcp package : Ubuntu - Launchpad
... indentation - PCI: Fix typo in pci_scan_child_bus_extend() * md: Replace ... ufs: ufs-mediatek: Fix build error and type mismatch - xfs: flush...
Read more >
[lwip-commits] [SCM] lwIP - A Lightweight TCPIP stack ...
[lwip-commits] [SCM] lwIP - A Lightweight TCPIP stack annotated tag ... SNMP error #defines to an enum and fix type mismatches discovered by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found