Bug 222980 - sysutils/battray fails
Summary: sysutils/battray fails
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Torsten Zuehlsdorff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-13 14:27 UTC by Marlad
Modified: 2017-11-09 14:35 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (tz)
tz: merge-quarterly+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marlad 2017-10-13 14:27:03 UTC
Hello,

battray does not work with python 3 in 11.1-RELEASE:

battray error: a bytes-like object is required, not 'str'  
  File "/usr/local/lib/python3.6/site-packages/battray/__init__.py", line 135, in update_status                        
    self.data['lifetime']) =  self.platform()                                                                          
  File "/usr/local/lib/python3.6/site-packages/battray/platforms.py", line 38, in freebsd                              
    for line in o.split('\n'):

The following patch solves this for me:

--- battray/platforms.py.orig   2017-10-13 15:38:32.473043000 +0200
+++ battray/platforms.py    2017-10-13 15:38:55.984945000 +0200
@@ -35,7 +35,7 @@

    o = subprocess.Popen(['acpiconf', '-i0'], stdout=subprocess.PIPE).communicate()[0]

-   for line in o.split('\n'):
+   for line in o.decode().split('\n'):
        if line.find(':') == -1:
            continue
        (key, value) = line.split(':', 1)
Comment 1 Marlad 2017-11-01 20:40:17 UTC
Hello,

This bug is already fixed in the current master branch of the project about 7 months ago. I asked the upstream author to create a new release for this Freebsd port.
Comment 2 Marlad 2017-11-08 15:01:08 UTC
Hello,

Martin kindly created a new release:
https://github.com/Carpetsmoker/battray/releases/tag/version-2.3

It works great, please update this port.
Comment 3 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2017-11-08 16:21:10 UTC
Good news. I wrote the patch and it will run through my test-machines over night. If anything is fine i can commit tomorrow. :)
Thanks!
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-11-09 14:02:02 UTC
A commit references this bug:

Author: tz
Date: Thu Nov  9 14:01:33 UTC 2017
New revision: 453808
URL: https://svnweb.freebsd.org/changeset/ports/453808

Log:
  sysutils/battray: Update from 2.1 to 2.3

  Fixes this Python 3 issue on FreeBSD 11.1:

  battray error: a bytes-like object is required, not 'str'
    File "/usr/local/lib/python3.6/site-packages/battray/__init__.py", line 135, in update_status
      self.data['lifetime']) =  self.platform()
    File "/usr/local/lib/python3.6/site-packages/battray/platforms.py", line 38, in freebsd
      for line in o.split('\n'):

  PR:          222980
  Reported by: bsd@mkfs.nl
  MFH:         2017Q4

Changes:
  head/sysutils/battray/Makefile
  head/sysutils/battray/distinfo
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-11-09 14:34:37 UTC
A commit references this bug:

Author: tz
Date: Thu Nov  9 14:34:30 UTC 2017
New revision: 453818
URL: https://svnweb.freebsd.org/changeset/ports/453818

Log:
  MFH: r453808

  sysutils/battray: Update from 2.1 to 2.3

  Fixes this Python 3 issue on FreeBSD 11.1:

  battray error: a bytes-like object is required, not 'str'
    File "/usr/local/lib/python3.6/site-packages/battray/__init__.py", line 135, in update_status
      self.data['lifetime']) =  self.platform()
    File "/usr/local/lib/python3.6/site-packages/battray/platforms.py", line 38, in freebsd
      for line in o.split('\n'):

  PR:          222980
  Reported by: bsd@mkfs.nl

  Approved by: ports-secteam (swills)

Changes:
_U  branches/2017Q4/
  branches/2017Q4/sysutils/battray/Makefile
  branches/2017Q4/sysutils/battray/distinfo
Comment 6 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2017-11-09 14:35:09 UTC
Committed, thanks! :)