Giter VIP home page Giter VIP logo

Comments (5)

danimtb avatar danimtb commented on August 15, 2024 1

I think is issue was solved with teh python_requires feature, which is a dedicated feature for this purpose.
https://docs.conan.io/en/latest/extending/python_requires.html

Feel free to comment or reopen in case you disagree. Thanks!

from docs.

lasote avatar lasote commented on August 15, 2024

Hi @dkgs You can fork this repo and make a PR.
You can build locally installing sphinx (pip install sphinx) and other require I can't remember sphinx-???
Then you can run make html and browse the _build folder.

But don't care if you cannot run the build, just make a PR to develop branch and we will fix any "style" thing we see.

Thanks!

from docs.

dkgs avatar dkgs commented on August 15, 2024

@lasote I think there is a misunderstanding and I apologize for it. When I said

If someone could quickly show me how to do it

I was talking on how to do the conan file template to inherit, not the documentation itself.

There will be no problem in writing the doc (as I already forked this repo :))

from docs.

memsharded avatar memsharded commented on August 15, 2024

A few tips:

  • There are two common approaches to create base or common recipes for many packages. One would be to generate the conanfile.py recipes from templates, with any string templating mechanism (the simplest would be a string search & replace for strings like %NAME% or %VERSION%, but other better alternatives as jinja can be used). The other one would be extending (inheriting) the python ConanFile recipe class.

  • The string template is very simple, just save in a ```conanfile.py.in`` the contents of the recipe, then have a master script that orchestrates the package creation just use it and replace the desired fields for each recipe

  • The extending one: Just put common code in an "abstract" base class:

from conans import ConanFile

class ConanBase(ConanFile):
    # common code here

Then have other classes (the actual recipes):

from . import ConanBase # Use real import here

class ConanPkgLib(ConanBase):
    name = "Pkg"
    version = "0.2"

The only trick is that the base class should be also added to the recipe, so the exports="*.py" field might be necessary.

from docs.

dkgs avatar dkgs commented on August 15, 2024

I like the idea of extending the base class, because even if common functionalities are used, the packages can differs in some specific points.
But what bothers me is that the base class should be added to the recipe. Does it means that if I have N packages sharing common functionalities, I have to copy the base class in each of them ? If so, isn't it possible to separate this base class and put it in another recipe and then the N-packages can add it to their requirements ?
This would be ideal, because the base class would be treated as a dependency, have a version and so on... but I can already see the problem : how to import this base class that is defined in the requirements and therefore should have already be imported...
So now we are stuck and should copy the base class in each package where we need it ? Otherwise, I didn't understand something.

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.