Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 103 lines (83 sloc) 3.26 KB
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Copyright 2011
# Author: Marcos Vanetta <>
# This program is free software: you can redistribute it and/or modify it
# under the terms of either or both of the following licenses:
# 1) the GNU Lesser General Public License version 3, as published by the
# Free Software Foundation; and/or
# 2) the GNU Lesser General Public License version 2.1, as published by
# the Free Software Foundation.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# PURPOSE. See the applicable version of the GNU Lesser General Public
# License for more details.
# You should have received a copy of both the GNU Lesser General Public
# License version 3 and version 2.1 along with this program. If not, see
# <>
"""Build tar.gz for pomodoro-indicator.
Needed packages to run (using Debian/Ubuntu package names):
python-appindicator 0.3.0-0ubuntu1
python-gobject 2.28.3-1ubuntu1.1
python-notify 0.1.1-2build4
python-gtk2-dev 0.1.1-2build4
import os
from distutils.command.install import install
from distutils.core import setup
class CustomInstall(install):
"""Custom installation class on package files.
It copies all the files into the "PREFIX/share/PROJECTNAME" dir.
def run(self):
"""Run parent install, and then save the install dir in the script."""
for script in self.distribution.scripts:
script_path = os.path.join(self.install_scripts,
with open(script_path, 'rb') as fh:
content =
content = content.replace('@ INSTALLED_BASE_DIR @',
with open(script_path, 'wb') as fh:
def finalize_options(self):
"""Alter the installation path."""
# the data path is under 'prefix'
data_dir = os.path.join(self.prefix, "share",
# if we have 'root', put the building path also under it (used normally
# by pbuilder)
if self.root is None:
build_dir = data_dir
build_dir = os.path.join(self.root, data_dir[1:])
# change the lib install directory so all package files go inside here
self.install_lib = build_dir
# save this custom data dir to later change the scripts
self._custom_data_dir = data_dir
name = 'pomodoro-indicator',
version = '0.0.1',
license = 'GPL-3',
author = 'Marcos Vanetta',
author_email = '',
description = 'Pomodoro technique app indicator.',
long_description = 'Pomodoro technique app indicator',
url = '',
packages = ["pomodoro"],
package_data = {"pomodoro": ["images/*.png"]},
scripts = ["bin/pomodoro-indicator"],
cmdclass = {
'install': CustomInstall,