tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: issue with python3 and pathlib in requires.txt (eyeD3)



Hello David!

David Brownlee writes:
> I'm looking at updating eyeD3 to 0.8.4 for python3 compatibility, and
> it generates a requires.txt of:
>
> six
> pathlib
> python-magic
>
> [display-plugin]
> grako
>
> pathlib is built into python3, so eyeD3 fails to run with:
>
> pkg_resources.DistributionNotFound: The 'pathlib' distribution was not
> found and is required by eyeD3
>
> Removing pathlib and six manually from the requires.txt avoids this
> issue - is there a better way to handle this?
> [...]

I would modify requirements/requirements.yml and adjust setup.py in
order to add `pathlib' only for Python <= 3.3. Possible patches that
does that are attached in this email
(i.e. pkgsrc/audio/eye3D/patches/).

Apart that, `six' and `py-magic' should be added to DEPENDS as
usual and `py-pathlib' will probably need something like that:

.include "../../lang/python/pyversion.mk"
.if "${PYPKGPREFIX}" == "py27"
DEPENDS+=	${PYPKGPREFIX}-pathlib-[0-9]*:../../devel/py-pathlib
.endif


(WARNING: I've only tested that the two patches discussed do the trick,
I have not tested other parts because I'm completely unfamiliar with
eye3D!)
$NetBSD$

Add main_py33 key in requirements.yml file to append dependencies only for
Python <= 3.3 (similar to test_py33).

--- requirements/requirements.yml.orig	2017-11-04 20:31:16.000000000 +0000
+++ requirements/requirements.yml
@@ -1,8 +1,10 @@
 main:
     - six
-    - pathlib # Remove with python 2.7 and 3.3
     - python-magic
 
+main_py33:
+    - pathlib
+
 extra_display-plugin:
     - grako
 
$NetBSD$

Honor main_py33 key in requirements.yml file to append dependencies only for
Python <= 3.3 (similar to test_py33).

--- setup.py.orig	2017-11-18 02:27:36.000000000 +0000
+++ setup.py
@@ -57,6 +57,9 @@ def getPackageInfo():
     requirements, extras = requirements_yaml()
     info_dict["install_requires"] = requirements["main"] \
                                         if "main" in requirements else []
+    if sys.version_info[:2] < (3, 4):
+        info_dict["install_requires"] += requirements["main_py33"] \
+                                            if "main" in requirements else []
     info_dict["tests_require"] = requirements["test"] \
                                      if "test" in requirements else []
     info_dict["extras_require"] = extras


Home | Main Index | Thread Index | Old Index