Bug 130911 - Policy on converting Perl scripts to Python
Summary: Policy on converting Perl scripts to Python
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.0.0
Keywords:
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2020-02-24 21:10 UTC by Jussi Pakkanen
Modified: 2023-08-16 03:05 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jussi Pakkanen 2020-02-24 21:10:26 UTC
As per the discussion in https://gerrit.libreoffice.org/c/core/+/89262

I would like to propose that converting Perl scripts used in Libreoffice can be ported to Python without needing any special rationale. The reasons for this are:

- more people know Python than Perl
- new developers (i.e. anyone under 35) do not know Perl at all
- Python is a lot more readable in any case
- Python has builtin functionality for a lot things where Perl needs to call external executables (like zip, tar), reducing dependencies
- Converting all Perl code to Python is (in practice) a requirement for removing Cygwin as a build dependency on Windows 

In practice this would mean that merge requests that convert Perl to Python could just have this in their commit messages:

See tdf#XXXXX for motivation.
Comment 1 Mike Kaganski 2020-02-25 07:32:12 UTC
I agree. Even if only as a pre-requisite to drop Cygwin dependency, this is already valid.
Comment 2 Commit Notification 2020-03-06 11:32:55 UTC
Jussi Pakkanen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6ec05ef6fef789f5646b773495285e845e155d77

tdf#130911: convert some token generation scripts from Perl to Python.

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2020-03-20 08:53:01 UTC
Jussi Pakkanen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b29fb89d0a49fde0f5757774d64a7aba8298ac75

tdf#130911: convert image-sort from Perl to Python

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Samuel Mehrbrodt (allotropia) 2020-03-20 13:15:44 UTC
Making an easy hack out of this.

Just pick one of the perl files: https://opengrok.libreoffice.org/search?project=core&type=perl
Comment 5 Commit Notification 2020-03-31 19:53:23 UTC
Jussi Pakkanen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d2c23609083d7b3e5267b1e4c923476cbc509d00

tdf#130911: convert desktop-translate from Perl to Python.

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Olivier Hallot 2020-04-10 01:10:49 UTC
Build fails. Linux Kubuntu, latest release.

autogen.input:

--with-lang=ALL
--with-help=online
--with-omindex=server
--without-krb5
--disable-postgresql-sdbc
--with-jdk-home=/usr/lib/jvm/default-java
--enable-kf5
--enable-qt5
--enable-gtk3-kde5
--with-myspell-dicts


Crash at

Traceback (most recent call last):
  File "/home/tdf/git/core/solenv/bin/desktop-translate.py", line 82, in <module>
    assert(value[-1] == '"')
AssertionError
Traceback (most recent call last):
  File "/home/tdf/git/core/solenv/bin/desktop-translate.py", line 82, in <module>
    assert(value[-1] == '"')
AssertionError
make[1]: *** [/home/tdf/git/core/sysui/CustomTarget_share.mk:245: /home/tdf/git/core/workdir/CustomTarget/sysui/share/libreofficedev/build.flag] Error 1
Comment 7 Jussi Pakkanen 2020-04-10 17:39:11 UTC
Can you test if this fixes it for you:

https://gerrit.libreoffice.org/c/core/+/92050
Comment 8 Olivier Hallot 2020-04-11 02:33:32 UTC
(In reply to Jussi Pakkanen from comment #7)
> Can you test if this fixes it for you:
> 
> https://gerrit.libreoffice.org/c/core/+/92050

Build in now OK with the patch
Comment 9 Stephan Bergmann 2020-04-24 08:21:54 UTC
(In reply to Olivier Hallot from comment #8)
> (In reply to Jussi Pakkanen from comment #7)
> > Can you test if this fixes it for you:
> > 
> > https://gerrit.libreoffice.org/c/core/+/92050
> 
> Build in now OK with the patch

but see <https://gerrit.libreoffice.org/c/core/+/92838> "Properly escape desktop file string values"
Comment 10 Stephan Bergmann 2020-04-24 10:06:58 UTC
(In reply to Jussi Pakkanen from comment #0)
> As per the discussion in https://gerrit.libreoffice.org/c/core/+/89262
> 
> I would like to propose that converting Perl scripts used in Libreoffice can
> be ported to Python without needing any special rationale. The reasons for
> this are:
> 
> - more people know Python than Perl
> - new developers (i.e. anyone under 35) do not know Perl at all
> - Python is a lot more readable in any case
> - Python has builtin functionality for a lot things where Perl needs to call
> external executables (like zip, tar), reducing dependencies
> - Converting all Perl code to Python is (in practice) a requirement for
> removing Cygwin as a build dependency on Windows 

I am not convinced that the above benefits necessarily outweigh the costs, though, or that any actual costs of conversion are at least distributed fairly in the developer base.  For example, I haven't counted the hours I had to spent on <https://git.libreoffice.org/core/+/13aebf3dc75a73b381fb8d72c9788a8ee5aa911c%5E!/> "Missing dependency", <https://git.libreoffice.org/core/+/9831d806ca7223058f74c61f4e1254c84464014d%5E!/> "Fix desktop-translate.py", <https://git.libreoffice.org/core/+/009db597027890ade07d31674c740ae0fc432f87%5E!/> "Only process with brand.pl the *.keys and *.desktop files", and <https://git.libreoffice.org/core/+/3f38a57a4ed8515dd145aea46ed697f101409c2f%5E!/> "Properly escape desktop file string values" after the change from comment 5.  (Though to be fair, the last two of those commits helped to find and address pre-existing issues.)
Comment 11 Jason Carty 2021-03-20 13:45:02 UTC
(In reply to Stephan Bergmann from comment #10)
> (In reply to Jussi Pakkanen from comment #0)
> > As per the discussion in https://gerrit.libreoffice.org/c/core/+/89262
> > 
> > I would like to propose that converting Perl scripts used in Libreoffice can
> > be ported to Python without needing any special rationale. The reasons for
> > this are:
> > 
> > - more people know Python than Perl
> > - new developers (i.e. anyone under 35) do not know Perl at all
> > - Python is a lot more readable in any case
> > - Python has builtin functionality for a lot things where Perl needs to call
> > external executables (like zip, tar), reducing dependencies
> > - Converting all Perl code to Python is (in practice) a requirement for
> > removing Cygwin as a build dependency on Windows 
> 
> I am not convinced that the above benefits necessarily outweigh the costs,
> though, or that any actual costs of conversion are at least distributed
> fairly in the developer base.  For example, I haven't counted the hours I
> had to spent on
> <https://git.libreoffice.org/core/+/
> 13aebf3dc75a73b381fb8d72c9788a8ee5aa911c%5E!/> "Missing dependency",
> <https://git.libreoffice.org/core/+/
> 9831d806ca7223058f74c61f4e1254c84464014d%5E!/> "Fix desktop-translate.py",
> <https://git.libreoffice.org/core/+/
> 009db597027890ade07d31674c740ae0fc432f87%5E!/> "Only process with brand.pl
> the *.keys and *.desktop files", and
> <https://git.libreoffice.org/core/+/
> 3f38a57a4ed8515dd145aea46ed697f101409c2f%5E!/> "Properly escape desktop file
> string values" after the change from comment 5.  (Though to be fair, the
> last two of those commits helped to find and address pre-existing issues.)

I'd like to continue converting some of the perl scripts to python. From this comment it feels like there needs to be more discussion. Am I able to start working on this easy hack?

Asking about it on the dev IRC it was suggested I give a heads up before working on this.
Comment 12 Stephan Bergmann 2021-03-22 08:42:58 UTC
(In reply to Jason Carty from comment #11)
> I'd like to continue converting some of the perl scripts to python. From
> this comment it feels like there needs to be more discussion. Am I able to
> start working on this easy hack?
> 
> Asking about it on the dev IRC it was suggested I give a heads up before
> working on this.

Samuel turned this "drive-by bug report" into an easy hack in comment 4.  I would thus hope that he weighs in on the conversation here.

(All I can personally say is what I already said in comment 10, though that is clearly unhelpful for anybody wanting to pick up this easy hack.)
Comment 13 Samuel Mehrbrodt (allotropia) 2021-03-22 09:54:29 UTC
Ok, I removed the easy hack from this task because of the controversy.

I mostly agree with Jussi in comment 0.
However, we don't want to cause too much work for other contributors.

I would suggest that anyone wanting to work on this, needs to carefully select a script, which he can run and test successfully (maybe start with the bin/ folder), and also commit to handling possible regressions.

Then hopefully we can get the benefits from comment 0 without too much hassle.
Comment 14 QA Administrators 2023-08-16 03:05:55 UTC
Dear Jussi Pakkanen,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug