First property descriptor is not parsed when exporting conanfile
See original GitHub issueEnvironment Details (include every applicable attribute)
- Linux 5.12.19-1-MANJARO
- gcc 11.1.0
- Conan 1.40
- Python 3.9.6
Steps to reproduce (Include if Applicable)
- Create directory with a conanfile.py
- Add a method decorated with a property descriptor after the class variables. See recipe below (Which is still WIP btw)
import os
from conans import ConanFile, tools
from conan.tools.gnu import AutotoolsDeps, Autotools, AutotoolsToolchain
from conan.tools.microsoft import MSBuildDeps, MSBuildToolchain, MSBuild
class PythonConan(ConanFile):
name = "Python"
version = "3.8.10"
description = "Python"
topics = ("conan", "python", "interpreter")
license = "PSF 2.0"
homepage = "https://www.python.org/"
url = "https://github.com/python/cpython"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
}
default_options = {
"shared": True,
}
scm = {
"type": "git",
"subfolder": ".",
"url": f"{url}.git",
"revision": f"v{version}"
}
@property
def fixme_property_bug(self):
return "The property descriptor is not parsed"
@property
def this_one_is_parsed(self):
return "This is correctly pares"
def requirements(self):
self.requires("openblas/0.3.15")
self.requires("geos/3.9.1")
self.requires("openssl/1.1.1k")
self.requires("sqlite3/3.36.0")
self.requires("libffi/3.4.2")
self.requires("xz_utils/5.2.5")
self.requires("zlib/1.2.11")
if self.settings.os == "Linux":
self.requires("bzip2/1.0.8")
def configure(self):
self.options["openblas"].shared = self.options.shared
self.options["geos"].shared = self.options.shared
self.options["openssl"].shared = self.options.shared
self.options["sqlite3"].shared = self.options.shared
self.options["libffi"].shared = self.options.shared
self.options["xz_utils"].shared = self.options.shared
self.options["zlib"].shared = self.options.shared
if self.settings.os == "Linux":
self.options["bzip2"].shared = self.options.shared
def generate(self):
if self.settings.os == "Windows":
# TODO: Windows is currently boilerplate
deps = MSBuildDeps(self)
deps.generate()
tc = MSBuildToolchain(self)
tc.generate()
else:
deps = AutotoolsDeps(self)
deps.generate()
tc = AutotoolsToolchain(self)
tc.configure_args.append(f"--prefix={os.path.join(self.install_folder, 'package')}")
tc.configure_args.append("--enable-ipv6")
tc.configure_args.append("--without-pymalloc")
tc.configure_args.append("--with-system-ffi")
tc.configure_args.append("--with-doc-strings")
tc.configure_args.append("--with-ensurepip")
if self.settings.build_type == "Debug":
tc.configure_args.append("--with-pydebug")
tc.cflags.append("-DPy_DEBUG")
else:
tc.configure_args.append("--with-lto")
tc.configure_args.append("--enable-optimizations")
if self.options.shared:
tc.configure_args.append("--enable-shared")
tc.generate()
def build(self):
if self.settings.os == "Windows":
# TODO: Windows is currently boilerplate
msbuild = MSBuild(self)
msbuild.build("PCBuild/pcbuild.sln")
else:
at = Autotools(self)
at.configure()
at.make(target = "clean")
at.make()
at.make(target = "clean")
at.make(target = "altinstall")
def package(self):
self.copy("*", src = os.path.join(self.build_folder, "package"), dst = ".")
def package_info(self):
v = tools.Version(self.version)
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = [f"include/python{v.major}.{v.minor}"]
self.user_info.interp = str(os.path.join(self.package_folder, "bin", self.interp_name))
self.user_info.pip = str(os.path.join(self.package_folder, "bin", self.pip_name))
self.runenv_info.prepend_path("PYTHONPATH", os.path.join(self.package_folder, f"python{v.major}.{v.minor}", "site-packages"))
self.runenv_info.prepend_path("PYTHONPATH", os.path.join(self.package_folder, f"python{v.major}.{v.minor}"))
@property
def pip_name(self) -> str:
pip = "pip"
if self.settings.os == "Windows":
pip += ".exe"
else:
v = tools.Version(self.version)
pip += f"{v.major}.{v.minor}"
return pip
@property
def interp_name(self) -> str:
interp = "python"
if self.settings.os == "Windows":
if self.settings.build_type == "Debug":
interp += "_d"
interp += ".exe"
else:
v = tools.Version(self.version)
interp += f"{v.major}.{v.minor}"
if self.settings.build_type == "Debug":
interp += "d"
return interp
- create package (used profiles can be found here: https://github.com/jellespijker/conan-config/tree/c1a1be92d357962718c79e8e49c872e9ac22e533/profiles )
conan create . ultimaker/testing -pr cura_release.jinja --build=missing
- Observe the export/conanfile.py when debugging with conanio notice that the
@property
decorator on the first methoddef fixme_property_bug(self):
after the class variables is missing.
import os
from conans import ConanFile, tools
from conan.tools.gnu import AutotoolsDeps, Autotools, AutotoolsToolchain
from conan.tools.microsoft import MSBuildDeps, MSBuildToolchain, MSBuild
class PythonConan(ConanFile):
name = "Python"
version = "3.8.10"
description = "Python"
topics = ("conan", "python", "interpreter")
license = "PSF 2.0"
homepage = "https://www.python.org/"
url = "https://github.com/python/cpython"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
}
default_options = {
"shared": True,
}
scm = {"revision": "v3.8.10",
"subfolder": ".",
"type": "git",
"url": "https://github.com/python/cpython.git"}
def fixme_property_bug(self):
return "The property descriptor is not parsed"
@property
def this_one_is_parsed(self):
return "This is correctly pares"
def requirements(self):
self.requires("openblas/0.3.15")
self.requires("geos/3.9.1")
self.requires("openssl/1.1.1k")
self.requires("sqlite3/3.36.0")
self.requires("libffi/3.4.2")
self.requires("xz_utils/5.2.5")
self.requires("zlib/1.2.11")
if self.settings.os == "Linux":
self.requires("bzip2/1.0.8")
def configure(self):
self.options["openblas"].shared = self.options.shared
self.options["geos"].shared = self.options.shared
self.options["openssl"].shared = self.options.shared
self.options["sqlite3"].shared = self.options.shared
self.options["libffi"].shared = self.options.shared
self.options["xz_utils"].shared = self.options.shared
self.options["zlib"].shared = self.options.shared
if self.settings.os == "Linux":
self.options["bzip2"].shared = self.options.shared
def generate(self):
if self.settings.os == "Windows":
# TODO: Windows is currently boilerplate
deps = MSBuildDeps(self)
deps.generate()
tc = MSBuildToolchain(self)
tc.generate()
else:
deps = AutotoolsDeps(self)
deps.generate()
tc = AutotoolsToolchain(self)
tc.configure_args.append(f"--prefix={os.path.join(self.install_folder, 'package')}")
tc.configure_args.append("--enable-ipv6")
tc.configure_args.append("--without-pymalloc")
tc.configure_args.append("--with-system-ffi")
tc.configure_args.append("--with-doc-strings")
tc.configure_args.append("--with-ensurepip")
if self.settings.build_type == "Debug":
tc.configure_args.append("--with-pydebug")
tc.cflags.append("-DPy_DEBUG")
else:
tc.configure_args.append("--with-lto")
tc.configure_args.append("--enable-optimizations")
if self.options.shared:
tc.configure_args.append("--enable-shared")
tc.generate()
def build(self):
if self.settings.os == "Windows":
# TODO: Windows is currently boilerplate
msbuild = MSBuild(self)
msbuild.build("PCBuild/pcbuild.sln")
else:
at = Autotools(self)
at.configure()
at.make(target = "clean")
at.make()
at.make(target = "clean")
at.make(target = "altinstall")
def package(self):
self.copy("*", src = os.path.join(self.build_folder, "package"), dst = ".")
def package_info(self):
v = tools.Version(self.version)
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = [f"include/python{v.major}.{v.minor}"]
self.user_info.interp = str(os.path.join(self.package_folder, "bin", self.interp_name))
self.user_info.pip = str(os.path.join(self.package_folder, "bin", self.pip_name))
self.runenv_info.prepend_path("PYTHONPATH", os.path.join(self.package_folder, f"python{v.major}.{v.minor}", "site-packages"))
self.runenv_info.prepend_path("PYTHONPATH", os.path.join(self.package_folder, f"python{v.major}.{v.minor}"))
@property
def pip_name(self) -> str:
pip = "pip"
if self.settings.os == "Windows":
pip += ".exe"
else:
v = tools.Version(self.version)
pip += f"{v.major}.{v.minor}"
return pip
@property
def interp_name(self) -> str:
interp = "python"
if self.settings.os == "Windows":
if self.settings.build_type == "Debug":
interp += "_d"
interp += ".exe"
else:
v = tools.Version(self.version)
interp += f"{v.major}.{v.minor}"
if self.settings.build_type == "Debug":
interp += "d"
return interp
Logs (Executed commands with output) (Include/Attach if Applicable)
... properly not relevant but can provide if required ...
Python/3.8.10@python/testing: Package '53d37ec4d16a28f3dc26171574a6b1d88179aa12' built
Python/3.8.10@python/testing: Build folder /home/peer23peer/.conan/data/Python/3.8.10/python/testing/build/53d37ec4d16a28f3dc26171574a6b1d88179aa12
Python/3.8.10@python/testing: Generated conaninfo.txt
Python/3.8.10@python/testing: Generated conanbuildinfo.txt
Python/3.8.10@python/testing: Generating the package
Python/3.8.10@python/testing: Package folder /home/peer23peer/.conan/data/Python/3.8.10/python/testing/package/53d37ec4d16a28f3dc26171574a6b1d88179aa12
Python/3.8.10@python/testing: Calling package()
Python/3.8.10@python/testing package(): Packaged 134 '.h' files
Python/3.8.10@python/testing package(): Packaged 7 '.0' files
Python/3.8.10@python/testing package(): Packaged 77 '.so' files
Python/3.8.10@python/testing package(): Packaged 2186 '.py' files
Python/3.8.10@python/testing package(): Packaged 117 '.txt' files
Python/3.8.10@python/testing package(): Packaged 28 files
Python/3.8.10@python/testing package(): Packaged 2 '.rst' files: includetest.rst, architecture.rst
Python/3.8.10@python/testing package(): Packaged 2 '.c' files: xxmodule.c, config.c
Python/3.8.10@python/testing package(): Packaged 1 '.sample' file: Setup.sample
Python/3.8.10@python/testing package(): Packaged 19 '.exe' files
Python/3.8.10@python/testing package(): Packaged 2 '.cfg' files: turtle.cfg, sysconfig.cfg
Python/3.8.10@python/testing package(): Packaged 2 '.bat' files: fetch_macholib.bat, idle.bat
Python/3.8.10@python/testing package(): Packaged 1 '.ctypes' file: README.ctypes
Python/3.8.10@python/testing package(): Packaged 1 '.in' file: config.c.in
Python/3.8.10@python/testing package(): Packaged 1 '.o' file: python.o
Python/3.8.10@python/testing package(): Packaged 1 '.local' file: Setup.local
Python/3.8.10@python/testing package(): Packaged 1 '.a' file: libpython3.8.a
Python/3.8.10@python/testing package(): Packaged 4 '.def' files: config-main.def, config-highlight.def, config-keys.def, config-extensions.def
Python/3.8.10@python/testing package(): Packaged 3 '.html' files: help.html, test_difflib_expect.html, sgml_input.html
Python/3.8.10@python/testing package(): Packaged 1 '.pyw' file: idle.pyw
Python/3.8.10@python/testing package(): Packaged 5 '.png' files
Python/3.8.10@python/testing package(): Packaged 11 '.gif' files
Python/3.8.10@python/testing package(): Packaged 1 '.ico' file: idle.ico
Python/3.8.10@python/testing package(): Packaged 1 '.pth' file: distutils-precedence.pth
Python/3.8.10@python/testing package(): Packaged 2 '.tmpl' files: script.tmpl, script (dev).tmpl
Python/3.8.10@python/testing package(): Packaged 57 '.xml' files
Python/3.8.10@python/testing package(): Packaged 1 '.typed' file: py.typed
Python/3.8.10@python/testing package(): Packaged 24 '.pem' files
Python/3.8.10@python/testing package(): Packaged 1 '.css' file: _pydoc.css
Python/3.8.10@python/testing package(): Packaged 2 '.pickle' files: PatternGrammar3.8.10.final.0.pickle, Grammar3.8.10.final.0.pickle
Python/3.8.10@python/testing package(): Packaged 3 '.whl' files: pip-21.1.1-py3-none-any.whl, setuptools-56.0.0-py3-none-any.whl, example-21.12-py3-none-any.whl
Python/3.8.10@python/testing package(): Packaged 1 '.ps1' file: Activate.ps1
Python/3.8.10@python/testing package(): Packaged 1 '.fish' file: activate.fish
Python/3.8.10@python/testing package(): Packaged 1 '.csh' file: activate.csh
Python/3.8.10@python/testing package(): Packaged 4 '.pck' files: pstats.pck, randv3.pck, randv2_64.pck, randv2_32.pck
Python/3.8.10@python/testing package(): Packaged 2 '.1' files: cfgparser.1, python3.8.1
Python/3.8.10@python/testing package(): Packaged 1 '.3' file: cfgparser.3
Python/3.8.10@python/testing package(): Packaged 1 '.test' file: clinic.test
Python/3.8.10@python/testing package(): Packaged 1 '.aif' file: Sine-1000Hz-300ms.aif
Python/3.8.10@python/testing package(): Packaged 2 '.tar' files: recursion.tar, testtar.tar
Python/3.8.10@python/testing package(): Packaged 7 '.zip' files
Python/3.8.10@python/testing package(): Packaged 1 '.types' file: mime.types
Python/3.8.10@python/testing package(): Packaged 1 '.vbs' file: empty.vbs
Python/3.8.10@python/testing package(): Packaged 8 '.au' files
Python/3.8.10@python/testing package(): Packaged 1 '.crl' file: revocation.crl
Python/3.8.10@python/testing package(): Packaged 1 '.2' file: cfgparser.2
Python/3.8.10@python/testing package(): Packaged 5 '.aiff' files
Python/3.8.10@python/testing package(): Packaged 1 '.voc' file: sndhdr.voc
Python/3.8.10@python/testing package(): Packaged 1 '.sndt' file: sndhdr.sndt
Python/3.8.10@python/testing package(): Packaged 1 '.8svx' file: sndhdr.8svx
Python/3.8.10@python/testing package(): Packaged 5 '.wav' files
Python/3.8.10@python/testing package(): Packaged 1 '.hcom' file: sndhdr.hcom
Python/3.8.10@python/testing package(): Packaged 3 '.aifc' files: sndhdr.aifc, pluck-ulaw.aifc, pluck-alaw.aifc
Python/3.8.10@python/testing package(): Packaged 4 '.file' files: utf-16.file, utf-8.file, binary.file, binary.file
Python/3.8.10@python/testing package(): Packaged 1 '.egg' file: example-21.12-py3.6.egg
Python/3.8.10@python/testing package(): Packaged 3 '.stp' files: gc.stp, assert_usable.stp, call_stack.stp
Python/3.8.10@python/testing package(): Packaged 5 '.expected' files
Python/3.8.10@python/testing package(): Packaged 4 '.d' files: call_stack.d, assert_usable.d, line.d, gc.d
Python/3.8.10@python/testing package(): Packaged 1 '.exr' file: python.exr
Python/3.8.10@python/testing package(): Packaged 1 '.bmp' file: python.bmp
Python/3.8.10@python/testing package(): Packaged 1 '.webp' file: python.webp
Python/3.8.10@python/testing package(): Packaged 1 '.xbm' file: python.xbm
Python/3.8.10@python/testing package(): Packaged 1 '.ras' file: python.ras
Python/3.8.10@python/testing package(): Packaged 1 '.tiff' file: python.tiff
Python/3.8.10@python/testing package(): Packaged 1 '.sgi' file: python.sgi
Python/3.8.10@python/testing package(): Packaged 1 '.ppm' file: python.ppm
Python/3.8.10@python/testing package(): Packaged 1 '.pgm' file: python.pgm
Python/3.8.10@python/testing package(): Packaged 1 '.pbm' file: python.pbm
Python/3.8.10@python/testing package(): Packaged 1 '.jpg' file: python.jpg
Python/3.8.10@python/testing package(): Packaged 1 '.out' file: test.xml.out
Python/3.8.10@python/testing package(): Packaged 1 '.xsl' file: doc.xsl
Python/3.8.10@python/testing package(): Packaged 1 '.dtd' file: doc.dtd
Python/3.8.10@python/testing package(): Packaged 143 '.decTest' files
Python/3.8.10@python/testing package(): Packaged 1 '.sh' file: header.sh
Python/3.8.10@python/testing package(): Packaged 1 '.md' file: README.md
Python/3.8.10@python/testing package(): Packaged 2 '.pc' files: python-3.8.pc, python-3.8-embed.pc
Python/3.8.10@python/testing package(): Packaged 5 '.8' files
Python/3.8.10@python/testing package(): Packaged 1 '.8-config' file: python3.8-config
Python/3.8.10@python/testing: Package '53d37ec4d16a28f3dc26171574a6b1d88179aa12' created
Python/3.8.10@python/testing: Created package revision f9f8aee56fbc9f1f4a7bcc5d69816688
ERROR: Python/3.8.10@python/testing: Error in package_info() method, line 123
self.user_info.interp = str(os.path.join(self.package_folder, "bin", self.interp_name))
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'method'
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Recipe and Sources in the Same Repo - Conan Docs
Using the exports sources attribute of the conanfile to: export the source code together with the recipe. This way the recipe is self-contained...
Read more >Methods — conan 1.53.0 documentation
Method used to retrieve the source code from any other external origin like github using $ git clone or just a regular download....
Read more >Attributes — conan 1.53.0 documentation
SCM attributes are evaluated in the working directory where the conanfile.py is located before exporting it to the Conan cache, so these values...
Read more >conan export — conan 1.44.1 documentation
Copies the recipe (conanfile.py & associated files) to your local cache. Use the 'reference' param to specify a user and channel where to...
Read more >Troubleshooting — conan 1.55.0 documentation
Invalid setting 'Linux' is not a valid 'settings.os' value. Possible values are ['Windows'] Read ... ERROR: conanfile.py: Error while initializing options.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great then!
As that behavior is already considered legacy and already removed in Conan 2.0, I am closing this issue, not worth investing resources in fixing it. Thanks!
Hi @jellespijker
Sure, dont worry 😃 Even if we put a good effort in the docs, it is always difficult, we know it needs even more work so we are preparing the next major update of the docs, trying to improve it again.
You can enable it with:
But even better, you should go to your conan.conf in the cache, and write the
scm_to_conandata=1
in thegeneral
section. Even more: you should create a repo with all your configuration, yourconan.conf
, yourremotes.txt
, your profiles, and use it with theconan config install
command. That way you make sure all your devs and CI use the same configuration.