Bug 375472

Summary: kfilemetadata test scripts have unnecessary dependency on Python 2
Product: [Frameworks and Libraries] frameworks-kfilemetadata Reporter: A. Wilcox (awilfox) <awilfox>
Component: generalAssignee: Pinak Ahuja <pinak.ahuja>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.29.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://phabricator.kde.org/D4377
Latest Commit: Version Fixed/Implemented In: 5.37.0
Sentry Crash Report:
Attachments: Universal Python patch for KFileMetadata 5.23-5.29

Description A. Wilcox (awilfox) 2017-01-23 21:05:09 UTC
Created attachment 103608 [details]
Universal Python patch for KFileMetadata 5.23-5.29

The test scripts for external extractor and external writer use a simple Python script.  This is great, but there are two issues with the scripts:

- unnecessary imports of {os.path,os,subprocess}
- shebang uses /usr/bin/python2 when the scripts function on Python 3.4 and 3.5

Attached patch should work, and has been tested on the following matrix:

- KFileMetadata 5.23, 5.26, and 5.29.
- glibc and musl libcs on Linux 4.4 kernel
- x86, x86_64, ppc
- Python 2.7, Python 3.4.4, Python 3.5.2
Comment 1 A. Wilcox (awilfox) 2018-01-03 02:57:09 UTC
Fixed in commit 76ed16d7943791c851ea2222afd9afedd3127b02
Author:     A. Wilcox <mailto:awilfox@adelielinux.org>
AuthorDate: Tue Jul 11 21:41:34 2017 +0200
Commit:     Matthieu Gallien <matthieu_gallien@yahoo.fr>
CommitDate: Sat Jul 29 16:51:36 2017 +0200

    Fix Python dependency in test scripts for KFileMetaData (bug 375472)
    
    Summary:
    KFileMetaData test scripts are usable in both deprecated Python 2, and new Python 3.  This removes 'python2' from the shebang and uses the regular 'python' interpreter, thereby removing the requirement of Python 2 being on a system to be able to test KFileMetaData.
    
    Additionally, it removes unused imports.
    
    Test Plan:
    This patch was applied to:
    * 5.23
    * 5.26
    * 5.29
    
    It was tested on Linux kernel 4.4 using:
    * x86_64
    * x86_32
    * PowerPC
    
    With the following Python versions:
    * 2.7.10
    * 3.4.4
    * 3.5.1
    
    It was tested on glibc and musl libc.
    
    Reviewers: mgallien
    
    Reviewed By: mgallien
    
    Subscribers: #frameworks
    
    Tags: #frameworks
    
    Differential Revision: https://phabricator.kde.org/D4377