#2 Switch to Python 3
Closed 2 years ago by raveit65. Opened 3 years ago by carlwgeorge.
rpms/ carlwgeorge/python-caja master  into  master

file modified
+28 -28
@@ -1,18 +1,22 @@ 

+ # Without this, some documentation files end up in /usr/share/doc/python3-caja.

+ # They should all go in /usr/share/doc/python-caja.

+ %global _docdir_fmt %{name}


  %global _description\

  Python bindings for Caja


  Name:           python-caja

  Version:        1.20.0

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Epoch:          1

  Summary:        Python bindings for Caja


  Group:          Development/Libraries

  License:        GPLv2+ and LGPLv2+

- URL:            http://mate-desktop.org

- Source0:        http://pub.mate-desktop.org/releases/1.20/%{name}-%{version}.tar.xz

+ URL:            https://mate-desktop.org

+ Source0:        https://pub.mate-desktop.org/releases/1.20/%{name}-%{version}.tar.xz


- BuildRequires:  python2-devel

+ BuildRequires:  python3-devel

  BuildRequires:  caja-devel

  BuildRequires:  pygobject3-devel

  BuildRequires:  mate-common
@@ -20,16 +24,16 @@ 


  %description %_description


- %package -n python2-caja

- Summary: %summary

- %{?python_provide:%python_provide python2-caja}

+ %package -n python3-caja

+ Summary: %{summary}

+ %{?python_provide:%python_provide python3-caja}


- %description -n python2-caja %_description

+ %description -n python3-caja %_description


  %package devel

  Summary:        Python bindings for Caja

  Group:          Development/Libraries

- Requires:       python2-caja%{?_isa} = %{epoch}:%{version}-%{release}

+ Requires:       python3-caja%{?_isa} = %{epoch}:%{version}-%{release}


  %description devel

  Python bindings for Caja
@@ -37,39 +41,30 @@ 



  %autosetup -p1

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/background-image.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/block-size-column.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/location-widget-provider.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/md5sum-property-page.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/open-terminal.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/submenu.py

- sed -i -e 's~#!/usr/bin/python~#!%{__python2}~g' examples/update-file-info-async.py




- %configure \

-      --disable-static


+ export PYTHON=python3

+ %configure --disable-static

  make %{?_smp_mflags}




- %{make_install}

- mkdir -p $RPM_BUILD_ROOT%{_datadir}/caja-python/extensions

- find $RPM_BUILD_ROOT -name '*.la' -delete

+ %make_install

+ mkdir -p %{buildroot}%{_datadir}/caja-python/extensions

+ find %{buildroot} -name '*.la' -delete


  # We use %%doc instead

- rm $RPM_BUILD_ROOT%{_docdir}/python-caja/README

+ rm %{buildroot}%{_docdir}/python-caja/README


  %find_lang %{name} --with-gnome --all-name


- %post -p /sbin/ldconfig


- %postun -p /sbin/ldconfig

+ %ldconfig_scriptlets



- %files -n python2-caja -f %{name}.lang


+ %files -n python3-caja -f %{name}.lang

+ %license COPYING




  %dir %{_datadir}/caja-python
@@ -81,6 +76,11 @@ 




+ * Mon Mar 26 2018 Carl George <carl@george.computer> - 1:1.20.0-3

+ - Switch to Python 3

+ - Move COPYING to /usr/share/licenses

+ - Put all documentation in /usr/share/doc/python-caja


  * Sun Feb 11 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1:1.20.0-2

  - Update Python 2 dependency declarations to new packaging standards

    (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

  • Switch to Python 3
  • Move COPYING to /usr/share/licenses
  • Put all documentation in /usr/share/doc/python-caja

scratch build

I am still wondering that python-caja is python3 compatible?
Upstream didn't switched to python3.

I believe that's the minimum version required.




The first argument, if present, is the minimum version of Python required for this package

It compiles and links against Python 3.6 successfully.

$ rpm -qp --requires python3-caja-1.20.0-3.fc29.x86_64.rpm | grep python

But a few packages depends on python-caja (not mine), did you updated them too?


Good catch, I have not (yet). Initially I wanted to change the spec file to have both python2 and python3 versions, until I realized that it's files weren't inside the normal %{python2_sitelib}/%{python3_sitelib} locations. Is it even possible to have two versions of this?

To be completely honest I don't even use caja (or mate), I just found this package on the Python 3 Porting Database and wanted to help.

Thanks for helping, python stuff isn't really my favorite.

I would prefer a clean jump to python3 without providing 2 versions.
I think python2 should be removed from f29, correct?
I read something in devel-list about.....
In this case it is save to merge the PR and maintainer of this dependencies have to follow.
No sure if we should announced this soname bump?

If some packages depend on python2-caja, there are two options:

  • Package both versions, python2-caja and python3-caja, until all are switched
  • Coordinate with all maintainers, and switch all of them at once

BTW, compared to Fedora 26, there's a new dependent package in Rawhide, rabbitvcs-caja.

$ sudo dnf --disablerepo=\* --enablerepo=rawhide repoquery --whatrequires python2-caja

@pviktori This isn't a normal python library. It doesn't install any files into /usr/lib*/python*/site-packages, but rather creates /usr/lib64/caja/extensions-2.0/libcaja-python.so. I don't if it's possible to ship parallel python2/python3 versions of the file. I have opened an upstream issue to get clarification.


I have no idea what this package is for. I can dnf install caja and that allows me to:

>>> from gi.repository import Caja

From both Pythons. Having (or not having) python2-caja installed doesn't seem to make any difference.

It is is needed for some python-extensions for caja.
I listed the package already here.

Nitroshare is out of the game. Upstream has dropped any integration via python and this seems to mean the feature won't be supported in any future version.

Ok, at the moment we haven't a response from owncloud-client

I don't wan't to wait any longer for owncloud maintainer.
No answer since more than 4 months.
I merge this.
Thanks for PR.

PR was outdated because of updated versions, so i simply commit that for myself.
But there are some build warnings which i don't get with python2 build for f28.

caja-python.c: In function 'caja_python_load_dir':
caja-python.c:148:15: warning: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration]
     py_path = PyString_FromString(dirname);
caja-python.c:148:13: warning: assignment to 'PyObject *' {aka 'struct _object *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     py_path = PyString_FromString(dirname);
caja-python.c: In function 'caja_python_init_python':
caja-python.c:181:19: warning: passing argument 2 of 'PySys_SetArgv' from incompatible pointer type [-Wincompatible-pointer-types]
  PySys_SetArgv(1, argv);
In file included from /usr/include/python3.7m/Python.h:123,
                 from caja-python.c:24:
/usr/include/python3.7m/sysmodule.h:17:37: note: expected 'wchar_t **' {aka 'int **'} but argument is of type 'char **'
 PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
caja-python-object.c: In function 'caja_python_object_get_property_pages':
caja-python-object.c:88:39: warning: implicit declaration of function 'PyString_Check'; did you mean 'PyMapping_Check'? [-Wimplicit-function-declaration]
      if (!PySequence_Check(py_ret) || PyString_Check(py_ret))       \
caja-python-object.c:163:2: note: in expansion of macro 'HANDLE_LIST'
  HANDLE_LIST(py_ret, CajaPropertyPage, "Caja.PropertyPage");
caja-python-object.c: In function 'caja_python_object_get_widget':
caja-python-object.c:197:11: warning: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration]
  py_uri = PyString_FromString(uri);
caja-python-object.c:197:9: warning: assignment to 'PyObject *' {aka 'struct _object *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  py_uri = PyString_FromString(uri);
caja-python-object.c: In function 'caja_python_object_update_file_info':
caja-python-object.c:428:7: warning: implicit declaration of function 'PyInt_Check'; did you mean 'PySet_Check'? [-Wimplicit-function-declaration]
  if (!PyInt_Check(py_ret))
caja-python-object.c:435:8: warning: implicit declaration of function 'PyInt_AsLong'; did you mean 'PyLong_AsLong'? [-Wimplicit-function-declaration]
  ret = PyInt_AsLong(py_ret);
In file included from caja-python-object.c:26:
caja-python-object.c: In function 'caja_python_object_get_type':
caja-python-object.c:525:30: warning: implicit declaration of function 'PyString_AsString'; did you mean 'PyBytes_AsString'? [-Wimplicit-function-declaration]
  debug_enter_args("type=%s", PyString_AsString(PyObject_GetAttrString(type, "__name__")));
caja-python.h:40:84: note: in definition of macro 'debug_enter_args'
                                      g_printf("%s: entered " x "\n", __FUNCTION__, y); }
caja-python.h:40:47: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Wformat=]
                                      g_printf("%s: entered " x "\n", __FUNCTION__, y); }
caja-python-object.c:525:2: note: in expansion of macro 'debug_enter_args'
  debug_enter_args("type=%s", PyString_AsString(PyObject_GetAttrString(type, "__name__")));
caja-python-object.c:525:26: note: format string is defined here
  debug_enter_args("type=%s", PyString_AsString(PyObject_GetAttrString(type, "__name__")));
caja-python-object.c:536:32: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
  type_name = g_strdup_printf("%s+CajaPython",
         PyString_AsString(PyObject_GetAttrString(type, "__name__")));

I have no idea about python and if those warnings cause problems i will drop this package with next fedora dev cycle.

Pull-Request has been closed by raveit65

2 years ago