2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4
# Copyright (C) 2010 Артём Попов <artfwo@gmail.com>
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
18
###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
1
#! /usr/bin/env python3
3
import DistUtilsExtra.auto
24
import DistUtilsExtra.auto
26
print >> sys.stderr, 'To build indicator-cpufreq you need https://launchpad.net/python-distutils-extra'
28
assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
30
def update_data_path(prefix, oldvalue=None):
33
fin = file('indicator_cpufreq/indicator_cpufreqconfig.py', 'r')
34
fout = file(fin.name + '.new', 'w')
37
fields = line.split(' = ') # Separate variable from value
38
if fields[0] == '__indicator_cpufreq_data_directory__':
39
# update to prefix, store oldvalue
42
line = "%s = '%s'\n" % (fields[0], prefix)
43
else: # restore oldvalue
44
line = "%s = %s" % (fields[0], oldvalue)
50
os.rename(fout.name, fin.name)
51
except (OSError, IOError), e:
52
print ("ERROR: Can't find indicator_cpufreq/indicator_cpufreqconfig.py")
57
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
59
previous_value = update_data_path(self.prefix + '/share/indicator-cpufreq/')
60
DistUtilsExtra.auto.install_auto.run(self)
61
update_data_path(self.prefix, previous_value)
65
##################################################################################
66
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
67
##################################################################################
6
from DistUtilsExtra.command import *
71
8
DistUtilsExtra.auto.setup(
72
9
name='indicator-cpufreq',
76
13
author_email='artfwo@gmail.com',
77
14
description='CPU frequency scaling indicator',
78
15
long_description='Indicator applet for displaying and changing CPU frequency on-the-fly.',
79
16
url='https://launchpad.net/indicator-cpufreq',
80
cmdclass={'install': InstallAndUpdateDataDirectory},
81
# FIXME: install icons as data_files until we resolve it with quickly
17
# install icons as data_files because distutils don't do that well
83
19
('share/icons/ubuntu-mono-dark/status/22',
84
20
glob.glob('icons/ubuntu-mono-dark/*')),
85
21
('share/icons/ubuntu-mono-light/status/22',
86
22
glob.glob('icons/ubuntu-mono-light/*')),
23
# temp fix for LP: #1125598
24
('share/icons/hicolor/22x22/status',
25
glob.glob('icons/ubuntu-mono-dark/*')),
87
26
# ('/var/lib/polkit-1/localauthority/10-vendor.d',
88
27
# ['indicator-cpufreq.pkla']),