Re: [SyncEvolution] Detect python binary name in build time

2018-07-24 Thread Milan Crha
On Tue, 2018-07-24 at 17:38 +0200, Patrick Ohly wrote:
> I'm definitely interested.

Hi,
I asked, but failed. It seems python folks are covered with more
priority work, at least there where I tried. Thus I'm sorry, I do not
have anyone able to port the files at the moment. I've been redirected
to: https://portingguide.readthedocs.io/
For what I tried myself, by simply changing the shebangs to python3 in
the build-time scripts, some worked, but some failed on the syntax. I
cannot speak of the actual results of those scripts though.

> The Arch maintainer filed an issue for the
> same problem and attached his own patch here:
> https://bugs.freedesktop.org/show_bug.cgi?id=107014

I see. It seems there are covered more files, even not in the generic
way as with my patch.

> But as you said, the real solution has to be a port to Python3. Would
> it be okay to drop Python2 support entirely?

>From my point of view yes, because python2 support will be dropped kind
of soon anyway: https://pythonclock.org/

> Doing so in a 1.5.x maintenance release sounds too intrusive.

I agree, changing dependencies in the stable release is not ideal.

> Should I target a 1.6.0 release with Python3 as dependency and also
> include my "cxx-future" branch, where I require C++11?

Sounds good to me, though I cannot talk for all interested parties.
Thanks and bye,
Milan


___
SyncEvolution mailing list
SyncEvolution@syncevolution.org
https://lists.syncevolution.org/mailman/listinfo/syncevolution


Re: [SyncEvolution] Detect python binary name in build time

2018-07-24 Thread Patrick Ohly
Milan Crha  writes:

>   Hello,
> there is some effort to rename 'python' to 'python2' in the
> distributions, but SyncEvolution still uses 'python' (without the
> version number) in its scripts. I made a change for Fedora to detect
> the installed python 2 binary name and use it in the scripts.
>
> I know, an ideal solution would be to port to python3 at the same time,
> but it's out of my knowledge, I do not speak pythonish and simple
> change to /usr/bin/python3 makes the provided scripts not to run with a
> runtime error about syntax and such, thus I decided to offer at least
> this change to you. Maybe I'll convince someone with python knowledge
> to port the scripts to python3, in which case I'd return back to you
> with a follow up change, if you are interested.

I'm definitely interested. The Arch maintainer filed an issue for the
same problem and attached his own patch here:
https://bugs.freedesktop.org/show_bug.cgi?id=107014

But as you said, the real solution has to be a port to Python3. Would it
be okay to drop Python2 support entirely? Doing so in a 1.5.x
maintenance release sounds too intrusive.

Should I target a 1.6.0 release with Python3 as dependency and also
include my "cxx-future" branch, where I require C++11?

-- 
Best Regards

Patrick Ohly
___
SyncEvolution mailing list
SyncEvolution@syncevolution.org
https://lists.syncevolution.org/mailman/listinfo/syncevolution


[SyncEvolution] Detect python binary name in build time

2018-07-16 Thread Milan Crha
Hello,
there is some effort to rename 'python' to 'python2' in the
distributions, but SyncEvolution still uses 'python' (without the
version number) in its scripts. I made a change for Fedora to detect
the installed python 2 binary name and use it in the scripts.

I know, an ideal solution would be to port to python3 at the same time,
but it's out of my knowledge, I do not speak pythonish and simple
change to /usr/bin/python3 makes the provided scripts not to run with a
runtime error about syntax and such, thus I decided to offer at least
this change to you. Maybe I'll convince someone with python knowledge
to port the scripts to python3, in which case I'd return back to you
with a follow up change, if you are interested.
Bye,
Milan
diff -up syncevolution-1.5.3/configure.ac.python2 syncevolution-1.5.3/configure.ac
--- syncevolution-1.5.3/configure.ac.python2	2018-01-09 16:53:28.0 +0100
+++ syncevolution-1.5.3/configure.ac	2018-07-16 18:31:06.970413427 +0200
@@ -62,6 +62,11 @@ dnl check for programs.
 AC_PROG_CXX
 AC_PROG_MAKE_SET
 
+AC_PATH_PROGS(PYTHON, python2 python, "")
+if test "x$PYTHON" = "x" ; then
+   AC_ERROR([python not found])
+fi
+
 dnl Use the most recent C++ standard that is supported by the code.
 dnl We can fall back to older versions, but not below C++11.
 dnl Akonadi/Qt don't work with C++17 yet, so we can't enable that.
diff -up syncevolution-1.5.3/src/src.am.python2 syncevolution-1.5.3/src/src.am
--- syncevolution-1.5.3/src/src.am.python2	2018-01-05 16:10:27.0 +0100
+++ syncevolution-1.5.3/src/src.am	2018-07-16 18:30:04.703414288 +0200
@@ -42,12 +42,12 @@ if COND_DBUS
 nodist_bin_SCRIPTS += src/syncevo-http-server
 endif
 src/syncevo-http-server: $(top_srcdir)/test/syncevo-http-server.py
-	$(AM_V_GEN)cp $< $@
+	$(AM_V_GEN)sed -e 's|\@PYTHON\@|$(PYTHON)|' $< > $@
 CLEANFILES += src/syncevo-http-server
 
 nodist_bin_SCRIPTS += src/syncevo-phone-config
 src/syncevo-phone-config: $(top_srcdir)/test/syncevo-phone-config.py
-	$(AM_V_GEN)cp $< $@
+	$(AM_V_GEN)sed -e 's|\@PYTHON\@|$(PYTHON)|' $< > $@
 CLEANFILES += src/syncevo-phone-config
 
 SYNCEVOLUTION_DEP =
@@ -72,7 +72,7 @@ src/synccompare : $(top_srcdir)/test/Alg
 bin_SCRIPTS += src/synclog2html
 CLEANFILES += src/synclog2html
 src/synclog2html: $(top_srcdir)/test/log2html.py
-	$(AM_V_GEN)cp $< $@ && chmod u+x $@
+	$(AM_V_GEN)sed -e 's|\@PYTHON\@|$(PYTHON)|' $< > $@ && chmod u+x $@
 
 CORE_SOURCES =
 
@@ -367,7 +367,7 @@ testcase2patch: $(TEST_FILES_GENERATED)
 nodist_noinst_DATA += src/ClientTest.cpp.html
 CLEANFILES += src/ClientTest.cpp.html
 src/ClientTest.cpp.html: build/source2html.py test/ClientTest.cpp
-	$(AM_V_GEN)python $+ >$@
+	$(AM_V_GEN)$(PYTHON) $+ >$@
 
 # copy base test files
 $(filter-out %.tem, $(filter src/testcases/%, $(subst $(top_srcdir)/test/,src/,$(CLIENT_LIB_TEST_FILES : src/% : $(top_srcdir)/test/%
diff -up syncevolution-1.5.3/test/log2html.py.python2 syncevolution-1.5.3/test/log2html.py
--- syncevolution-1.5.3/test/log2html.py.python2	2014-04-25 09:55:47.0 +0200
+++ syncevolution-1.5.3/test/log2html.py	2018-07-16 18:30:04.703414288 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!@PYTHON@
 
 """
 Converts the .log output for a client-test test into HTML, with
diff -up syncevolution-1.5.3/test/syncevo-http-server.py.python2 syncevolution-1.5.3/test/syncevo-http-server.py
--- syncevolution-1.5.3/test/syncevo-http-server.py.python2	2016-09-26 13:20:05.0 +0200
+++ syncevolution-1.5.3/test/syncevo-http-server.py	2018-07-16 18:30:04.703414288 +0200
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!@PYTHON@
 
 '''Usage: syncevo-http-server.py 
 Runs a SyncML HTTP server under the given base URL.'''
diff -up syncevolution-1.5.3/test/syncevo-phone-config.py.python2 syncevolution-1.5.3/test/syncevo-phone-config.py
--- syncevolution-1.5.3/test/syncevo-phone-config.py.python2	2014-04-25 09:55:48.0 +0200
+++ syncevolution-1.5.3/test/syncevo-phone-config.py	2018-07-16 18:30:04.704414288 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!@PYTHON@
 #
 # Copyright (C) 2010 Intel Corporation
 #
___
SyncEvolution mailing list
SyncEvolution@syncevolution.org
https://lists.syncevolution.org/mailman/listinfo/syncevolution