Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion usr/lib/linuxmint/mintUpdate/automatic_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
power_supply_file = open(power_connectfile)
powersupply = power_supply_file.read()[0]=='1'
power_supply_file.close()
if !powersupply:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a valid python statement:

  File "/tmp/tmp.NzVPhaFruT/automatic_upgrades.py", line 23
    if !powersupply:
       ^
SyntaxError: invalid syntax

battery_capacity_file = open('/sys/class/power-supply/BAT0/capacity')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on Linux kernel ABI documentation for power:

Suggested change
battery_capacity_file = open('/sys/class/power-supply/BAT0/capacity')
battery_capacity_file = open('/sys/class/power_supply/BAT0/capacity')

ABI for power is not stable, BAT0 may differ; so your code should consider that.

battery_capacity = int(battery_capacity_file.read())
battery_capacity_file.close()
except:
powersupply = True
log.write(power_connectfile+" not found. Ignore power supply check.")
if powersupply:
if powersupply or battery_capacity >= 75:
try:
# Put shutdown and reboot blocker into place
os.symlink(pkla_source, pkla_target)
Expand Down