vowstar / kflash.py

kflash, A Python-based cross-platform Kendryte K210 UART ISP Utility
MIT License
6 stars 8 forks source link

Dependency on backports.weakref #3

Closed damien-lemoal closed 2 years ago

damien-lemoal commented 2 years ago

The indirect dependency on python backports.weakref (from backports.tempfile) is causing many problems when trying to integrate kflash as a buildroot package. I tried to do this as part of the RISC-V NOMMU support series I posted to the buildroot list (code here: https://github.com/damien-lemoal/buildroot/tree/k210-v18). While I did succeed in the end to get kflash added as a package, the dependencies extend to the need for pip and openssl, which end up breaking u-boot builds as target/host openssl build conflicts.

How difficult would it be to remove the dependencies on these backports.xxx packages ? Is it possible ?

damien-lemoal commented 2 years ago

Replying to myself here. I tried this:

diff --git a/kflash.py b/kflash.py
index f9b099b..8f76887 100755
--- a/kflash.py
+++ b/kflash.py
@@ -12,7 +12,7 @@ import binascii
 import hashlib
 import argparse
 import math
-import zipfile, tempfile, backports.tempfile
+import zipfile, tempfile
 import json
 import re
 import os
diff --git a/setup.py b/setup.py
index be651c1..b8bf018 100644
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,6 @@ setup(
     install_requires=[
         "pyserial>=3.4",
         "pyelftools>=0.25",
-        "backports.tempfile>=1.0",
     ],
     entry_points={
         "console_scripts": [

And things are still working OK (beside the reboot problem I raised in the other issue). Can you confirm ?

vowstar commented 2 years ago

The indirect dependency on python backports.weakref (from backports.tempfile) is causing many problems when trying to integrate kflash as a buildroot package. I tried to do this as part of the RISC-V NOMMU support series I posted to the buildroot list (code here: https://github.com/damien-lemoal/buildroot/tree/k210-v18). While I did succeed in the end to get kflash added as a package, the dependencies extend to the need for pip and openssl, which end up breaking u-boot builds as target/host openssl build conflicts.

How difficult would it be to remove the dependencies on these backports.xxx packages ? Is it possible ?

The introduction of backports.tempfile is mainly to support python2.7, which has been eliminated. In fact, I wanted to remove this thing for a long time.

The only thing used from backports.tempfile is tempfile.TemporaryDirectory(), so it is not very difficult.

vowstar commented 2 years ago

I have fixed this problem in release v1.1.1, tested on both python2.7 and python3.9

damien-lemoal commented 2 years ago

Great ! Thanks for that !. Tested right now with buildroot package and all is fine :)