1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import shutil
import glob
import math
import tools.gpick
Import('*')
DEBNAME = "gpick"
DEBVERSION = str(env['GPICK_BUILD_VERSION'])+"-1"
DEBMAINT = "Albertas Vyšniauskas <albertas.vysniauskas@gpick.org>"
DEBARCH = env['DEBARCH']
DEBDEPENDS = "libgtk2.0-0 (>= 2.24), libc6 (>= 2.13), liblua5.2-0 (>= 5.2), libcairo2 (>=1.8), libglib2.0-0 (>=2.24)"
DEBPRIORITY = "optional"
DEBSECTION = "graphics"
DEBDESC = "Advanced color picker"
DEBDESCLONG = """ Gpick is a program used to pick colors
from anywhere on the screen, mix them to
get new colors, generate shades and tints
and export palettes to common file formats
or simply copy them to the clipboard
"""
DEBPACKAGEFILE = '%s_%s_%s.deb' % (DEBNAME, DEBVERSION, DEBARCH)
CONTROL_TEMPLATE = """Package: %s
Version: %s
Section: %s
Priority: %s
Architecture: %s
Depends: %s
Installed-Size: %s
Maintainer: %s
Description: %s
%s
"""
DEBCONTROLDIR = os.path.join(DEBNAME, "DEBIAN")
DEBCONTROLFILE = os.path.join(DEBCONTROLDIR, "control")
DEBINSTALLDIR = os.path.join('deb' , DEBNAME, 'usr')
env['DESTDIR'] = DEBINSTALLDIR #redirect install location
def debian_write_control(target=None, source=None, env=None):
installed_size = 0
files = tools.gpick.Glob(os.path.join('build', 'deb', DEBNAME, 'usr'))
for i in files:
installed_size += os.stat(str(i))[6]
installed_size = int(math.ceil(installed_size/1024))
control_info = CONTROL_TEMPLATE % (
DEBNAME, DEBVERSION, DEBSECTION, DEBPRIORITY, DEBARCH,
DEBDEPENDS, str(installed_size), DEBMAINT, DEBDESC, DEBDESCLONG)
f = open(str(target[0]), 'w')
f.write(control_info)
f.close()
return None
env.Append(BUILDERS = {'DebianPackage' : Builder(action = "fakeroot dpkg-deb -b %s %s" % ("$SOURCE", "$TARGET") )})
env.Append(BUILDERS = {'DebianControl' : Builder(action = debian_write_control)})
env.Alias(target="debian", source=[
env.Install(dir=DEBCONTROLDIR, source=[env.Glob("DEBIAN/*")]),
env.DebianControl(source = env.Alias('install'), target = DEBCONTROLFILE),
env.DebianPackage(source = env.Dir(DEBNAME), target = os.path.join('.', DEBPACKAGEFILE))
])
|