5
# Copyright 2011 malev.com.ar
7
# Author: Marcos Vanetta <marcosvanetta@gmail.com>
9
# This program is free software: you can redistribute it and/or modify it
10
# under the terms of either or both of the following licenses:
12
# 1) the GNU Lesser General Public License version 3, as published by the
13
# Free Software Foundation; and/or
14
# 2) the GNU Lesser General Public License version 2.1, as published by
15
# the Free Software Foundation.
17
# This program is distributed in the hope that it will be useful, but
18
# WITHOUT ANY WARRANTY; without even the implied warranties of
19
# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
20
# PURPOSE. See the applicable version of the GNU Lesser General Public
21
# License for more details.
23
# You should have received a copy of both the GNU Lesser General Public
24
# License version 3 and version 2.1 along with this program. If not, see
25
# <http://www.gnu.org/licenses/>
28
"""Build tar.gz for pomodoro-indicator.
29
Needed packages to run (using Debian/Ubuntu package names):
30
python-zope.testbrowser 3.5.1
31
python-mechanize 0.1.11
32
python-twisted-bin 8.2.0
40
from distutils.command.install import install
41
from distutils.core import setup
44
class CustomInstall(install):
45
"""Custom installation class on package files.
47
It copies all the files into the "PREFIX/share/PROJECTNAME" dir.
50
"""Run parent install, and then save the install dir in the script."""
53
for script in self.distribution.scripts:
54
script_path = os.path.join(self.install_scripts,
55
os.path.basename(script))
56
with open(script_path, 'rb') as fh:
58
content = content.replace('@ INSTALLED_BASE_DIR @',
59
self._custom_data_dir)
60
with open(script_path, 'wb') as fh:
64
def finalize_options(self):
65
"""Alter the installation path."""
66
install.finalize_options(self)
68
# the data path is under 'prefix'
69
data_dir = os.path.join(self.prefix, "share",
70
self.distribution.get_name())
72
# if we have 'root', put the building path also under it (used normally
77
build_dir = os.path.join(self.root, data_dir[1:])
79
# change the lib install directory so all package files go inside here
80
self.install_lib = build_dir
82
# save this custom data dir to later change the scripts
83
self._custom_data_dir = data_dir
87
name = 'pomodoro-indicator',
90
author = 'Marcos Vanetta',
91
author_email = 'marcosvanetta@gmail.com',
92
description = 'Pomodoro technique app indicator.',
93
long_description = 'Pomodoro technique app indicator',
94
url = 'https://github.com/malev/pomodoro-indicator',
96
packages = ["pomodoro-indicator"],
97
package_data = {"pomodoro-indicator": ["images/*.png"]},
98
scripts = ["bin/pomodoro-indicator"],
101
'install': CustomInstall,