Git Product home page Git Product logo

Comments (11)

bitsk avatar bitsk commented on June 24, 2024

@ivankravets

How to set up can automatically install kflash dependency package?

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

You need to pack kflash tool with pre-installed Python packages. See example with https://bintray.com/beta/#/platformio/dl-packages/tool-pulp-debug-bridge?tab=files.
Please download this file tool-pulp-debug-bridge-darwin_x86 and take a look at scripts/build.py.
Lines: 78-107.

So, the core idea is to install dependencies to python/site-packages and later inject them into Python sitedir.

from platform-kendryte210.

hhhhljp avatar hhhhljp commented on June 24, 2024

The problem has been solved, I made the download location of enum34 wrong, it should be installed in the file directory of pio

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

This is a bug. You no need to install extra packages with PlatformIO. Package should contain all dependencies.

from platform-kendryte210.

bitsk avatar bitsk commented on June 24, 2024

I saw your example, but I still can't figure out what happened to the package during the installation process. Can I use pip directly during installation? Kflash has been released as a package in pypi, and its setup.py may be able to handle these dependencies.

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

We don't run python setup.py when installing a package. We just unpack it and move to ~/.platformio/packages folder.
It's not easy to install Python package because it can lead to a lot of issues. There are built-in Python installation in OS, custom virtual environment for PIO Core etc... Each of them has own site-packages storage.

So, keeping package totally independent of pip resolves all issues with local Python installation. Also, it resolves issue with install package without administrative/sudo permissions.

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

We need to pack enum34 and pyelftool into the package. Could you try to do that?

from platform-kendryte210.

bitsk avatar bitsk commented on June 24, 2024

I am trying...
I noticed this function,

def install_pysite(dst, packages):
    for package in packages:
        subprocess.call(["pip", "install", "--no-compile", "-t", dst, package])

But I don't know how it is called. Is it executed once in kflash.py every time it runs?

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

You can run pip install -t from CLI. That script was provided as a hint. You actually don’t need it.

from platform-kendryte210.

bitsk avatar bitsk commented on June 24, 2024

I used a simple way to get kflash out of dependencies, which can now be run directly.

This may not be a perfect method.
image

        {
            "sha1": "87ef5303917ff2e1fcc7b2bc194f67bd14e5f597",
            "system": "*",
            "url": "http://dl.sipeed.com/MAIX/platformio/dl-packages/tool-kflash-kendryte210-v0.8.2.tar.gz",
            "version": "0.8.2"
        },

from platform-kendryte210.

ivankravets avatar ivankravets commented on June 24, 2024

@btx000 Thanks! I think we can live with it :)

I've just deployed this package. I've just thought, we can actually can run $PYTHONEXE -m pip install platform.get_package_dir("tool-kflash-kendryte210") before uploading. In this case, we will install kflash dependencies to PIO Core site-packages.

Nevertheless, keeping packages in an isolated environment is a better option.

from platform-kendryte210.

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.