diff -Nru bambam-0.6+dfsg/50-dont-vt-switch.conf bambam-1.0.1+dfsg/50-dont-vt-switch.conf --- bambam-0.6+dfsg/50-dont-vt-switch.conf 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/50-dont-vt-switch.conf 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1,10 @@ +# Placing this file in /etc/X11/xorg.conf.d (and restarting X) will disable +# virtual terminal switching. +# +# NOTE that it is known to cause problems with gdm - see +# https://github.com/porridge/bambam/issues/16 +# Make sure you have an alternative way to recover your system, or be prepared +# for a hard reset. +Section "ServerFlags" + Option "DontVTSwitch" "true" +EndSection diff -Nru bambam-0.6+dfsg/bambam.6 bambam-1.0.1+dfsg/bambam.6 --- bambam-0.6+dfsg/bambam.6 2016-11-14 06:57:43.000000000 +0000 +++ bambam-1.0.1+dfsg/bambam.6 2018-12-20 14:15:35.000000000 +0000 @@ -1,4 +1,4 @@ -.TH bambam 6 "14 November 2016" "version 0.6" +.TH bambam 6 "17 December 2018" "version 1.0.1" .SH NAME bambam \- a keyboard mashing and doodling game for babies .SH SYNOPSIS @@ -12,6 +12,9 @@ \fB\-d\fR, \fB\-\-deterministic\-sounds\fR Whether to produce same sounds on same key presses. .TP +\fB\-D\fR, \fB\-\-dark\fR +Use a dark background instead of a light one. +.TP \fB\-m\fR, \fB\-\-mute\fR Whether to mute sounds. .TP @@ -29,9 +32,24 @@ The screen is cleared at random. .SH NOTES \fBTo quit, type quit in the game\fR. +.PP To turn the sound off and on, type mute and unmute, respectively, in the game. +.PP +bambam loads images (GIF, JPEG, PNG and TIFF files) and sounds (WAV and OGG +files) from the following directories: +.IP \(bu +the \fBdata\fR directory distributed with the game, +.IP \(bu +\fB$XDG_DATA_HOME\fR (usually ~/.local/share/bambam/data) +.PP +When scanning directories for files, bambam \fBdoes\fR follow symbolic links +and descend directories. This makes is easy to have bambam use files located +elsewhere. +.PP +Be aware that bambam does not block virtual terminal switching (e.g. +CTRL+ALT+F1). See the example 50-dont-vt-switch.conf file if you would like to +block that. .SH AUTHOR Spike Burch .BR Marcin Owsiany - diff -Nru bambam-0.6+dfsg/bambam.py bambam-1.0.1+dfsg/bambam.py --- bambam-0.6+dfsg/bambam.py 2016-11-14 06:57:43.000000000 +0000 +++ bambam-1.0.1+dfsg/bambam.py 2018-12-20 14:15:35.000000000 +0000 @@ -1,8 +1,10 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # Copyright (C) # 2007-2008 Don Brown, # 2010 Spike Burch , # 2015-2016 Vasya Novikov +# 2018 Olivier Mehani +# 2018 Marcin Owsiany # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,232 +19,375 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import pygame, sys,os, random, string, glob +from __future__ import print_function +import pygame +import sys +import os +import random +import string import argparse import fnmatch -from pygame.locals import * +from pygame.locals import Color, RLEACCEL, QUIT, KEYDOWN, MOUSEMOTION, MOUSEBUTTONDOWN, MOUSEBUTTONUP -# draw filled circle at mouse position -def draw_dot(): - r = 30 - mousex, mousey = pygame.mouse.get_pos() - - dot = pygame.Surface((2 * r, 2 * r)) - pygame.draw.circle(dot, get_color(), (r, r), r, 0) - dot.set_colorkey(0, pygame.RLEACCEL) - - screen.blit(dot, (mousex - r, mousey - r)) - - -# Return bright color varying over time -def get_color(): - col = Color('white'); - - hue = pygame.time.get_ticks() / 50 % 360 - col.hsva = (hue, 100, 100, 50) - - return Color(col.r, col.g, col.b) - - -# Load image/, handling setting of the transparency color key -def load_image(fullname, colorkey = None): - try: - image = pygame.image.load(fullname) - except pygame.error, message: - print "Cannot load image:", fullname - raise SystemExit, message - image = image.convert() - if colorkey is not None: - if colorkey is -1: - colorkey = image.get_at((0, 0)) - image.set_colorkey(colorkey, RLEACCEL) - return image - - -# Load sound file in data/ -def load_sound(name): - class NoneSound: - def play(self): pass - if not pygame.mixer: - return NoneSound() - try: - sound = pygame.mixer.Sound(name) - except pygame.error, message: - print "Cannot load sound:", name - raise SystemExit, message - return sound - - -def load_items(lst, blacklist, load_function): - """Runs load_function on elements of lst unless they are blacklisted.""" - result = [] - for name in lst: - if True in [fnmatch.fnmatch(name, p) for p in blacklist]: - print "Skipping blacklisted item:", name - else: - result.append(load_function(name)) - return result +class BambamException(Exception): + """Represents a bambam-specific exception.""" + pass + + +class ResourceLoadException(BambamException): + """Represents a failure to load a resource.""" + + def __init__(self, resource, message): + self._resource = resource + self._message = message + + def __str__(self): + return 'Failed to load %s: %s' % (self._resource, self._message) + + +class Bambam: + IMAGE_MAX_WIDTH = 700 + + args = None + + colors = None + images = None + sounds = None + + background = None + screen = None + sheight = None + swidth = None + + mouse_down = None + sequence = None + sound_muted = None + + @classmethod + def get_color(cls): + """ + Return bright color varying over time. + """ + col = Color('white') + + hue = pygame.time.get_ticks() / 50 % 360 + col.hsva = (hue, 100, 100, 50) + + return Color(col.r, col.g, col.b) + + @classmethod + def load_image(cls, fullname, colorkey=None): + """ + Load image/, handling setting of the transparency color key. + """ + try: + image = pygame.image.load(fullname) + + size_x, size_y = image.get_rect().size + if (size_x > cls.IMAGE_MAX_WIDTH or size_y > cls.IMAGE_MAX_WIDTH): + new_size_x = cls.IMAGE_MAX_WIDTH + new_size_y = int(cls.IMAGE_MAX_WIDTH * (float(size_y)/size_x)) + if new_size_y < 1: + raise ResourceLoadException(fullname, "image has 0 height after resize") + + image = pygame.transform.scale(image, (new_size_x, new_size_y)) + + except pygame.error as message: + raise ResourceLoadException(fullname, message) + + image = image.convert() + if colorkey is not None: + if colorkey is -1: + colorkey = image.get_at((0, 0)) + image.set_colorkey(colorkey, RLEACCEL) + return image + + @classmethod + def load_sound(cls, name): + """ + Load sound file in "data/". + """ + class NoneSound: + def play(self): pass + if not pygame.mixer or not pygame.mixer.get_init(): + return NoneSound() + try: + return pygame.mixer.Sound(name) + except pygame.error as message: + raise ResourceLoadException(name, message) + + @classmethod + def load_items(cls, lst, blacklist, load_function, items_type): + """ + Runs load_function on elements of lst unless they are blacklisted. + """ + result = [] + errors_encountered = False + for name in lst: + if any(fnmatch.fnmatch(name, p) for p in blacklist): + print("Skipping blacklisted item:", name) + else: + try: + result.append(load_function(name)) + except ResourceLoadException as e: + print(e) + errors_encountered = True + if not result and errors_encountered: + raise BambamException("All %s failed to load." % items_type) + return result + + @classmethod + def is_latin(cls, key): + """ + Is the key that was pressed alphanumeric. + """ + return (key < 255 + and (chr(key) in string.ascii_letters + or chr(key) in string.digits)) + + def draw_dot(self): + """ + draw filled circle at mouse position. + """ + r = 30 + mousex, mousey = pygame.mouse.get_pos() + + dot = pygame.Surface((2 * r, 2 * r)) + pygame.draw.circle(dot, self.get_color(), (r, r), r, 0) + dot.set_colorkey(0, pygame.RLEACCEL) + + self.screen.blit(dot, (mousex - r, mousey - r)) + + def input(self, events, quit_pos): + """ + Processes events. + """ + for event in events: + if event.type == QUIT: + sys.exit(0) + + # handle keydown event + elif event.type == KEYDOWN or event.type == pygame.JOYBUTTONDOWN: + # check for words like quit + if event.type == KEYDOWN: + if self.is_latin(event.key): + self.sequence += chr(event.key) + if self.sequence.find('quit') > -1: + sys.exit(0) + elif self.sequence.find('unmute') > -1: + self.sound_muted = False + # pygame.mixer.unpause() + self.sequence = '' + elif self.sequence.find('mute') > -1: + self.sound_muted = True + pygame.mixer.fadeout(1000) + self.sequence = '' + + # Clear the self.background 10% of the time + if random.randint(0, 10) == 1: + self.screen.blit(self.background, (0, 0)) + pygame.display.flip() + + # play random sound + if not self.sound_muted: + if event.type == KEYDOWN and self.args.deterministic_sounds: + self.sounds[event.key % len(self.sounds)].play() + else: + self.sounds[random.randint( + 0, len(self.sounds) - 1)].play() + + # show self.images + if event.type == pygame.KEYDOWN and (event.unicode.isalpha() or event.unicode.isdigit()): + self.print_letter(event.unicode) + else: + self.print_image() + pygame.display.flip() -# Processes events -def input(events, quit_pos): - global sequence, mouse_down, sound_muted - for event in events: - if event.type == QUIT: - sys.exit(0) - - # handle keydown event - elif event.type == KEYDOWN or event.type == pygame.JOYBUTTONDOWN: - # check for words like quit - if event.type == KEYDOWN: - if is_alpha(event.key): - sequence += chr(event.key) - if sequence.find('quit') > -1: - sys.exit(0) - elif sequence.find('unmute') > -1: - sound_muted = False - #pygame.mixer.unpause() - sequence = '' - elif sequence.find('mute') > -1: - sound_muted = True - pygame.mixer.fadeout(1000) - sequence = '' - - # Clear the background 10% of the time - if random.randint(0, 10) == 1: - screen.blit(background, (0, 0)) + # mouse motion + elif event.type == MOUSEMOTION: + if self.mouse_down: + self.draw_dot() + pygame.display.flip() + + # mouse button down + elif event.type == MOUSEBUTTONDOWN: + self.draw_dot() + self.mouse_down = True pygame.display.flip() - - # play random sound - if not sound_muted: - if event.type == KEYDOWN and args.deterministic_sounds: - sounds[event.key % len(sounds)].play() - else: - sounds[random.randint(0, len(sounds) -1)].play() - # show images - if event.type == pygame.KEYDOWN and (event.unicode.isalpha() or event.unicode.isdigit()): - print_letter(event.unicode) + # mouse button up + elif event.type == MOUSEBUTTONUP: + self.mouse_down = False + + return quit_pos + + def print_image(self): + """ + Prints an image at a random location. + """ + img = self.images[random.randint(0, len(self.images) - 1)] + w = random.randint(0, self.swidth - img.get_width()) + h = random.randint(0, self.sheight - img.get_height()) + self.screen.blit(img, (w, h)) + + def print_letter(self, char): + """ + Prints a letter at a random location. + """ + font = pygame.font.Font(None, 256) + if self.args.uppercase: + char = char.upper() + text = font.render( + char, 1, self.colors[random.randint(0, len(self.colors) - 1)]) + textpos = text.get_rect() + center = (textpos.width // 2, textpos.height // 2) + w = random.randint(0 + center[0], self.swidth - center[0]) + h = random.randint(0 + center[1], self.sheight - center[1]) + textpos.centerx = w + textpos.centery = h + self.screen.blit(text, textpos) + + def glob_dir(self, path, extensions): + files = [] + for file_name in os.listdir(path): + path_name = os.path.join(path, file_name) + if os.path.isdir(path_name): + files.extend(self.glob_dir(path_name, extensions)) else: - print_image() - pygame.display.flip() - - # mouse motion - elif event.type == MOUSEMOTION : - if mouse_down: - draw_dot() - pygame.display.flip() - - # mouse button down - elif event.type == MOUSEBUTTONDOWN: - draw_dot() - mouse_down = True - pygame.display.flip() - - # mouse button up - elif event.type == MOUSEBUTTONUP: - mouse_down = False - - return quit_pos - - -# Prints an image at a random location -def print_image(): - #global swidth, sheigh - img = images[random.randint(0, len(images) - 1)] - w = random.randint(0, swidth - img.get_width()) - h = random.randint(0, sheight - img.get_height()) - screen.blit(img, (w, h)) - -# Is the key that was pressed alphanumeric -def is_alpha(key): - return key < 255 and (chr(key) in string.letters or chr(key) in string.digits) - -# Prints a letter at a random location -def print_letter(char): - global args - font = pygame.font.Font(None, 256) - if args.uppercase: - char = char.upper() - text = font.render(char, 1, colors[random.randint(0, len(colors) - 1)]) - textpos = text.get_rect() - center = (textpos.width / 2, textpos.height / 2) - w = random.randint(0 + center[0], swidth - center[0]) - h = random.randint(0 + center[1], sheight - center[1]) - textpos.centerx = w - textpos.centery = h - screen.blit(text, textpos) + for ext in extensions: + if path_name.lower().endswith(ext): + files.append(path_name) + break + + return files + + def glob_data(self, extensions): + """ + Search for files ending with any of the provided extensions. Eg: + extensions = ['.abc'] will be similar to `ls *.abc` in the configured + dataDirs. Matching will be case-insensitive. + """ + extensions = [x.lower() for x in extensions] + fileList = [] + for dataDir in self.dataDirs: + fileList.extend(self.glob_dir(dataDir, extensions)) + return fileList + + def run(self): + """ + Main application entry point. + """ + program_base = os.path.dirname(os.path.realpath(sys.argv[0])) + + self.dataDirs = [] + dist_data_dir = os.path.join(program_base, 'data') + if os.path.isdir(dist_data_dir): + print('Using data dir:', dist_data_dir) + self.dataDirs.append(dist_data_dir) + installed_data_dir = os.path.join(os.path.dirname(program_base), 'share') + xdg_data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share')) + for bambam_base_dir in [installed_data_dir, xdg_data_home]: + extraDataDir = os.path.join(bambam_base_dir, 'bambam', 'data') + if os.path.isdir(extraDataDir): + print('Using data dir:', extraDataDir) + self.dataDirs.append(extraDataDir) + + parser = argparse.ArgumentParser( + description='A keyboard mashing game for babies.') + parser.add_argument('-u', '--uppercase', action='store_true', + help='Whether to show UPPER-CASE letters.') + parser.add_argument('--sound_blacklist', action='append', default=[], + help='List of sound filename patterns to never play.') + parser.add_argument('--image_blacklist', action='append', default=[], + help='List of image filename patterns to never show.') + parser.add_argument('-d', '--deterministic-sounds', action='store_true', + help='Whether to produce same sounds on same key presses.') + parser.add_argument('-D', '--dark', action='store_true', + help='Use a dark background instead of a light one.') + parser.add_argument('-m', '--mute', action='store_true', + help='No sound will be played.') + self.args = parser.parse_args() + + pygame.init() + + if not pygame.font: + print('Warning, fonts disabled') + if not pygame.mixer or not pygame.mixer.get_init(): + print('Warning, sound disabled') + + # swith to full self.screen at current self.screen resolution + pygame.display.set_mode((0, 0), pygame.FULLSCREEN) + + # determine display resolution + displayinfo = pygame.display.Info() + self.swidth = displayinfo.current_w + self.sheight = displayinfo.current_h + + pygame.display.set_caption('Bam Bam') + self.screen = pygame.display.get_surface() + + self.background = pygame.Surface(self.screen.get_size()) + self.background = self.background.convert() + if self.args.dark: + self.background.fill((0, 0, 0)) + else: + self.background.fill((250, 250, 250)) + captionFont = pygame.font.SysFont(None, 20) + captionLabel = captionFont.render( + "Commands: quit, mute, unmute", + True, + (210, 210, 210), + (250, 250, 250)) + captionRect = captionLabel.get_rect() + captionRect.x = 15 + captionRect.y = 10 + self.background.blit(captionLabel, captionRect) + self.sequence = "" + self.screen.blit(self.background, (0, 0)) + pygame.display.flip() + + self.mouse_down = False + self.sound_muted = self.args.mute + + self.sounds = self.load_items( + self.glob_data(['.wav', '.ogg']), + self.args.sound_blacklist, + self.load_sound, + "sounds") + + self.images = self.load_items( + self.glob_data(['.gif', '.jpg', '.jpeg', '.png', '.tif', '.tiff']), + self.args.image_blacklist, + self.load_image, + "images") + + self.colors = ((0, 0, 255), (255, 0, 0), (255, 255, 0), + (255, 0, 128), (0, 0, 128), (0, 255, 0), + (255, 128, 0), (255, 0, 255), (0, 255, 255) + ) + + quit_pos = 0 + + clock = pygame.time.Clock() + + pygame.joystick.init() + + # Initialize all joysticks + joystick_count = pygame.joystick.get_count() + for i in range(joystick_count): + joystick = pygame.joystick.Joystick(i) + joystick.init() + + while True: + clock.tick(60) + quit_pos = self.input(pygame.event.get(), quit_pos) -# Main application -# -parser = argparse.ArgumentParser(description='A keyboard mashing game for babies.') -parser.add_argument('-u', '--uppercase', action='store_true', help='Whether to show UPPER-CASE letters.') -parser.add_argument('--sound_blacklist', action='append', default=[], help='List of sound filename patterns to never play.') -parser.add_argument('--image_blacklist', action='append', default=[], help='List of image filename patterns to never show.') -parser.add_argument('-d', '--deterministic-sounds', action='store_true', help='Whether to produce same sounds on same key presses.') -parser.add_argument('-m', '--mute', action='store_true', help='No sound will be played.') -args = parser.parse_args() - -if not pygame.font: print 'Warning, fonts disabled' -if not pygame.mixer: print 'Warning, sound disabled' - -pygame.init() - -# figure out the install base to use with image and sound loading -progInstallBase = os.path.dirname(os.path.realpath(sys.argv[0])); - -# swith to full screen at current screen resolution -window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) - -# determine display resolution -displayinfo = pygame.display.Info() -swidth = displayinfo.current_w -sheight = displayinfo.current_h - -pygame.display.set_caption('Bam Bam') -screen = pygame.display.get_surface() - -background = pygame.Surface(screen.get_size()) -background = background.convert() -background.fill((250, 250, 250)) -captionFont = pygame.font.SysFont(None, 20) -captionLabel = captionFont.render("Commands: quit, mute, unmute", True, (210, 210, 210), (250, 250, 250)) -captionRect = captionLabel.get_rect() -captionRect.x = 15 -captionRect.y = 10 -background.blit(captionLabel, captionRect) -sequence = "" -screen.blit(background, (0, 0)) -pygame.display.flip() - -mouse_down = False -sound_muted = args.mute - -def glob_data(pattern): - return glob.glob(os.path.join(progInstallBase, 'data', pattern)) - -sounds = load_items(glob_data('*.wav'), args.sound_blacklist, load_sound) - -colors = (( 0, 0, 255), (255, 0, 0), (255, 255, 0), - (255, 0, 128), ( 0, 0, 128), ( 0, 255, 0), - (255, 128, 0), (255, 0, 255), ( 0, 255, 255) -) - -images = load_items(glob_data('*.gif'), args.image_blacklist, load_image) - -quit_pos = 0 - -clock = pygame.time.Clock() - -pygame.joystick.init() - -# Initialize all joysticks -joystick_count = pygame.joystick.get_count() -for i in range(joystick_count): - joystick = pygame.joystick.Joystick(i) - joystick.init() - - -while True: - clock.tick(60) - quit_pos = input(pygame.event.get(), quit_pos) + +if __name__ == '__main__': + try: + bambam = Bambam() + bambam.run() + except BambamException as e: + print(e) + sys.exit(1) diff -Nru bambam-0.6+dfsg/debian/bambam.desktop bambam-1.0.1+dfsg/debian/bambam.desktop --- bambam-0.6+dfsg/debian/bambam.desktop 2014-07-12 15:25:23.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/bambam.desktop 2018-12-17 10:25:59.000000000 +0000 @@ -5,4 +5,5 @@ Icon=bambam Terminal=false Type=Application -Categories=Game; +Categories=Game;KidsGame; +Keywords=baby;child;game;mashing;doodling; diff -Nru bambam-0.6+dfsg/debian/changelog bambam-1.0.1+dfsg/debian/changelog --- bambam-0.6+dfsg/debian/changelog 2016-11-14 07:15:03.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/changelog 2018-12-17 10:25:59.000000000 +0000 @@ -1,3 +1,21 @@ +bambam (1.0.1+dfsg-1) sid; urgency=medium + + * New upstream release + * Started maintaining the debian packaging in the upstream repository (in a + separate branch called "debian") using git-buildpackage: + - dropped the DFSGFY script as the orig tarballs are now automatically + generated from the debian+dfsg branch with + `gbp buildpackage --git-component=extrasounds` + * Added an autopkgtest script + * Rewrote the copyright file in DEP-5 format. + * Bumped Standards-Version to 4.2.1 (no other changes needed). + * Added keywords and another category to desktop file. + * Improved the Vcs-* headers. + * Added an override for a spurious lintian warning about obsolete URL. + * Migrated to Python 3. Closes: #912489 + + -- Marcin Owsiany Mon, 17 Dec 2018 11:25:59 +0100 + bambam (0.6+dfsg-1) unstable; urgency=low * New upstream release diff -Nru bambam-0.6+dfsg/debian/control bambam-1.0.1+dfsg/debian/control --- bambam-0.6+dfsg/debian/control 2016-11-14 07:15:03.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/control 2018-12-17 10:25:59.000000000 +0000 @@ -2,14 +2,15 @@ Section: games Priority: optional Maintainer: Marcin Owsiany -Build-Depends: debhelper (>> 9), python, dh-python -Standards-Version: 3.9.8 +Build-Depends: debhelper (>> 9), python3, dh-python +Standards-Version: 4.2.1 Homepage: https://github.com/porridge/bambam -Vcs-Git: https://github.com/porridge/bambam.git +Vcs-Git: https://github.com/porridge/bambam.git -b debian +Vcs-Browser: https://github.com/porridge/bambam Package: bambam Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, python-pygame +Depends: ${misc:Depends}, ${python3:Depends}, python3-pygame Description: keyboard mashing and doodling game for babies Bambam is a simple baby keyboard masher application that locks the keyboard and mouse and instead displays bright colors, diff -Nru bambam-0.6+dfsg/debian/copyright bambam-1.0.1+dfsg/debian/copyright --- bambam-0.6+dfsg/debian/copyright 2014-07-12 14:54:09.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/copyright 2018-12-17 10:25:59.000000000 +0000 @@ -1,73 +1,85 @@ -This package was debianised by Bojana Borkovic - on Tue, 18 Oct 2011 19:30:00 +0100. - -It was downloaded from https://launchpad.net/bambam - -This version has been repacked to remove some sound files for which -there was no clear free licence. Some other sound files have been -added through a Debian patch. - -Upstream author: Spike Burch - -Copyright 2007-2008 Don Brown -Copyright 2010 Spike Burch -Copyright 2014 Marcin Owsiany - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -On Debian GNU/Linux systems, the complete text of the GNU General -Public License can be found in '/usr/share/common-licenses/GPL-3'. - -The following files in data/ were taken from tuxpaint: -bear.gif, dog.gif, frog.gif, iguana.gif, kangaroo.gif -as were the sound files in debian/sounds/ - - Copyright (c) 2002-2007 by Bill Kendrick and others - - Tuxpaint is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - On Debian systems, the complete text of the GNU General Public - License, version 2, can be found in /usr/share/common-licenses/GPL-2. - -The following files in data/ were taken from pygame: -alien1.gif, boom.wav, chimp.wmp, house_lo.wav, punch.wav, secosmic_lo.wav, whiff.wav - - Copyright: 2000-2003 Pete Shinners - 2006-2007 Rene Dudfield - 2007 Richard Goedeken - 2007-2008 Marcus von Appen - - This package is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - On Debian systems, the complete text of the GNU Lesser General - Public License can be found in "/usr/share/common-licenses/LGPL-2". +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: BamBam +Upstream-Contact: Marcin Owsiany +Source: + Current location https://github.com/porridge/bambam + Past locations include https://code.google.com/p/bambam/ and https://launchpad.net/bambam + This version has been repacked to remove some sound files for which there was + no clear free licence. Some other sound files have been added, see below. + +Files: * +Copyright: 2007-2008, Don Brown + 2010, Spike Burch + 2014-2018, Marcin Owsiany +License: GPL-3+ + +Files: debian/* +Copyright: 2011-2012, Bojana Borkovic + 2014-2018, Marcin Owsiany +License: GPL-3+ + +Files: data/bear.gif + data/dog.gif + data/frog.gif + data/iguana.gif + data/kangaroo.gif + extrasounds/* +Comment: these were taken from tuxpaint +Copyright: 2002-2007, Bill Kendrick and others +License: GPL-2+ + +Files: data/alien1.gif + data/boom.wav + data/chimp.gif + data/house_lo.wav + data/punch.wav + data/secosmic_lo.wav + data/whiff.wav +Comment: these were taken from pygame +Copyright: 2000-2003, Pete Shinners + 2006-2007, Rene Dudfield + 2007, Richard Goedeken + 2007-2008, Marcus von Appen +License: GPL-2+ + +Files: data/tux.gif +Copyright: 1996, Larry Ewing +License: Tux + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian GNU/Linux systems, the complete text of the GNU General + Public License can be found in '/usr/share/common-licenses/GPL-3'. + +License: GPL-2+ + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License can be found in "/usr/share/common-licenses/LGPL-2". + +License: Tux + Permission to use and/or modify this image is granted provided you acknowledge + me lewing@isc.tamu.edu and The GIMP if someone asks. diff -Nru bambam-0.6+dfsg/debian/DFGSIFY bambam-1.0.1+dfsg/debian/DFGSIFY --- bambam-0.6+dfsg/debian/DFGSIFY 2016-11-14 07:15:03.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/DFGSIFY 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -#!/bin/bash -set -e -if [ -z "$1" ]; then - echo "Usage: %0 " >&2 - exit 1 -fi -tainted="$1" -dfsg="$2" -if [ -e "$dfsg" ]; then - echo "Destination exists!" >&2 - ls -l "$dfsg" >&2 - exit 1 -fi -tmpdir=$(mktemp -d) -echo "Unpacking" >&2 -tar -zxv -C $tmpdir -f "$tainted" -subdir=$(echo $tmpdir/*) -if [ ! -d "$subdir" ]; then - echo "Something wrong with $subdir, expected it to be one directory, but found:" >&2 - ls -l "$tmpdir" >&2 - exit 1 -fi - -orig_wd=$(pwd) -cd "$subdir" -echo "Purging" >&2 -rm -rf debian -xargs rm -f <&2 -tar -zcv -C "$tmpdir" -f "$dfsg" "$(basename $subdir)" -rm -rf "$tmpdir" diff -Nru bambam-0.6+dfsg/debian/gbp.conf bambam-1.0.1+dfsg/debian/gbp.conf --- bambam-0.6+dfsg/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/gbp.conf 2018-12-17 10:25:59.000000000 +0000 @@ -0,0 +1,3 @@ +[DEFAULT] +debian-branch = debian +upstream-tag = v%(version)s diff -Nru bambam-0.6+dfsg/debian/patches/series bambam-1.0.1+dfsg/debian/patches/series --- bambam-0.6+dfsg/debian/patches/series 2014-07-12 14:30:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -set_install_base diff -Nru bambam-0.6+dfsg/debian/patches/set_install_base bambam-1.0.1+dfsg/debian/patches/set_install_base --- bambam-0.6+dfsg/debian/patches/set_install_base 2016-11-14 07:15:03.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/patches/set_install_base 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -Index: bambam-0.6+dfsg/bambam.py -=================================================================== ---- bambam-0.6+dfsg.orig/bambam.py 2016-11-14 09:54:30.892875006 +0100 -+++ bambam-0.6+dfsg/bambam.py 2016-11-14 09:55:26.976509632 +0100 -@@ -188,8 +188,8 @@ - - pygame.init() - --# figure out the install base to use with image and sound loading --progInstallBase = os.path.dirname(os.path.realpath(sys.argv[0])); -+# the install base to use with image and sound loading -+progInstallBase = '/usr/share/bambam' - - # swith to full screen at current screen resolution - window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) diff -Nru bambam-0.6+dfsg/debian/rules bambam-1.0.1+dfsg/debian/rules --- bambam-0.6+dfsg/debian/rules 2014-07-12 15:36:46.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/rules 2018-12-17 10:25:59.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/make -f %: - dh $@ --with python2 + dh $@ --with python3 override_dh_auto_install: dh_auto_install diff -Nru bambam-0.6+dfsg/debian/source/lintian-overrides bambam-1.0.1+dfsg/debian/source/lintian-overrides --- bambam-0.6+dfsg/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/source/lintian-overrides 2018-12-17 10:25:59.000000000 +0000 @@ -0,0 +1,3 @@ +# This URL is indeed obsolete, but listed together with other historical +# locations of the project for completeness. +bambam source: obsolete-url-in-packaging debian/copyright https://code.google.com/p/bambam/ diff -Nru bambam-0.6+dfsg/debian/source/options bambam-1.0.1+dfsg/debian/source/options --- bambam-0.6+dfsg/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/source/options 2018-12-17 10:25:59.000000000 +0000 @@ -0,0 +1 @@ +extend-diff-ignore = "(^|/)(\.venv|__pycache__)(/|$)" diff -Nru bambam-0.6+dfsg/debian/tests/control bambam-1.0.1+dfsg/debian/tests/control --- bambam-0.6+dfsg/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/tests/control 2018-12-17 10:25:59.000000000 +0000 @@ -0,0 +1,4 @@ +Test-Command: xvfb-run -e $AUTOPKGTEST_ARTIFACTS/xvfb-run.stderr -s "-screen 0 1024x768x24 -fbdir $AUTOPKGTEST_TMP" ./debian/tests/smoke-meat +Depends: @, python3, xvfb, xauth, imagemagick, xdotool +Features: test-name=smoke +Restrictions: allow-stderr # SDL complains about missing sound card to stderr diff -Nru bambam-0.6+dfsg/debian/tests/smoke-meat bambam-1.0.1+dfsg/debian/tests/smoke-meat --- bambam-0.6+dfsg/debian/tests/smoke-meat 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/debian/tests/smoke-meat 2018-12-17 10:25:59.000000000 +0000 @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +"""Checks whether bambam works. + +This is intended to be run by autopkgtest, with the environment set up to +connect to an Xvfb server in order to take screenshots from its XWD output +file. + +See the main() function for a high-level overview of what the script does. +""" + +import os +import re +import subprocess +import time + + +_COLOR_PATTERN = re.compile(r'^\D+(\d+),(\d+),(\d+)\D+') +_EXIT_SECONDS = 5 + + +def main(): + bambam = subprocess.Popen(['/usr/games/bambam']) + try: + await_startup() + test_functionality() + shut_bambam_down() + exit_code = bambam.wait(timeout=_EXIT_SECONDS) + if exit_code != 0: + raise Exception('Bambam exited with unexpected code %d.' % exit_code) + except: + take_screenshot('exception') + raise + + +def await_startup(): + attempt_count = 40 + for attempt in range(attempt_count): + current_average_color = get_average_color(symbolic_ok=True) + if current_average_color in ('white', [250]*3): + print('Found mostly white screen, looks like bambam started up OK.') + take_screenshot('startup') + return + print('On attempt %d the average screen color was %s.' % (attempt, current_average_color)) + time.sleep(0.25) + raise Exception('Failed to see bambam start after %d attempts.' % attempt_count) + + +def test_functionality(): + attempt_count = 1000 + for attempt in range(attempt_count): + send_keycodes('space', 'm') # any letter will do, but em is nice and big + time.sleep(0.005) # let the event propagate and bambam process it + if is_screen_colorful_enough(attempt): + take_screenshot('success') + return + raise Exception('Failed to see a colorful enough screen after %d attempts.' % attempt_count) + + +def is_screen_colorful_enough(attempt): + r, g, b = get_average_color() + if any(color > 225 for color in (r, g, b)): + print('On attempt %d the average screen color was too close to white: %d,%d,%d.' % ( + attempt, r, g, b)) + return False + else: + print('Found colorful enough screen, colors %d, %d, %d.' % (r, g, b)) + return True + + +def shut_bambam_down(): + send_keycodes('q', 'u', 'i', 't') + + +def take_screenshot(title): + subprocess.call([ + 'convert', + 'xwd:' + os.path.join(os.environ['AUTOPKGTEST_TMP'], 'Xvfb_screen0'), + os.path.join(os.environ['AUTOPKGTEST_ARTIFACTS'], '%s.png' % title)]) + + +def get_average_color(symbolic_ok=False): + color_str = subprocess.check_output([ + 'convert', + 'xwd:' + os.path.join(os.environ['AUTOPKGTEST_TMP'], 'Xvfb_screen0'), + '-resize', '1x1!', + '-format', '%[pixel:u]', + 'info:-']).decode() + m = _COLOR_PATTERN.match(color_str) + if not m: + if symbolic_ok: + return color_str.strip() + raise Exception('Failed to parse color ' + color_str) + return [int(i) for i in m.group(1, 2, 3)] + + +def send_keycodes(*keycodes): + subprocess.check_call(['xdotool', 'key', '+'.join(keycodes)]) + + +if __name__ == '__main__': + main() diff -Nru bambam-0.6+dfsg/.gitignore bambam-1.0.1+dfsg/.gitignore --- bambam-0.6+dfsg/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/.gitignore 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1,2 @@ +/.venv +/__pycache__ diff -Nru bambam-0.6+dfsg/README.md bambam-1.0.1+dfsg/README.md --- bambam-0.6+dfsg/README.md 2016-11-14 06:57:43.000000000 +0000 +++ bambam-1.0.1+dfsg/README.md 2018-12-20 14:15:35.000000000 +0000 @@ -5,19 +5,28 @@ ## Usage ## Before running this application, ensure you have the following installed: - * [Python](http://python.org) + * [Python](http://python.org) - version 3.x is recommended but version 2.7 should work too * [Pygame](http://www.pygame.org/) ### Installation ### - 1. [Download](https://github.com/porridge/bambam/releases) the bambam-0.6.zip or bambam-0.6.tar.gz file. - 1. Unzip bambam-0.6.zip or "tar zxvf bambam-0.6.tar.gz" to create the bambam-0.6 directory. - 1. Move into the 'bambam-0.6' directory + +First, see if your distribution has a bambam package already, for example: +``` +sudo apt install bambam +man bambam +bambam +``` + +If not, you can install it manually as follows: + 1. [Download](https://github.com/porridge/bambam/releases) the bambam-1.0.1.zip or bambam-1.0.1.tar.gz file. + 1. Unzip bambam-1.0.1.zip or "tar zxvf bambam-1.0.1.tar.gz" to create the bambam-1.0.1 directory. + 1. Move into the 'bambam-1.0.1' directory ``` -cd bambam-0.6 +cd bambam-1.0.1 ``` 1. Execute ``` -python bambam.py +./bambam.py ``` 1. To exit, type ``` diff -Nru bambam-0.6+dfsg/requirements-dev.txt bambam-1.0.1+dfsg/requirements-dev.txt --- bambam-0.6+dfsg/requirements-dev.txt 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/requirements-dev.txt 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1,6 @@ +autopep8==1.3.5 +flake8==3.5.0 +mccabe==0.6.1 +pycodestyle==2.3.1 +pyflakes==1.6.0 +pygame==1.9.3 diff -Nru bambam-0.6+dfsg/requirements.txt bambam-1.0.1+dfsg/requirements.txt --- bambam-0.6+dfsg/requirements.txt 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/requirements.txt 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1 @@ +pygame==1.9.3 diff -Nru bambam-0.6+dfsg/setup.cfg bambam-1.0.1+dfsg/setup.cfg --- bambam-0.6+dfsg/setup.cfg 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/setup.cfg 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 120 +[pep8] +max-line-length = 120 diff -Nru bambam-0.6+dfsg/.travis.yml bambam-1.0.1+dfsg/.travis.yml --- bambam-0.6+dfsg/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ bambam-1.0.1+dfsg/.travis.yml 2018-12-20 14:15:35.000000000 +0000 @@ -0,0 +1,10 @@ +language: python +python: +- "2.7" +- "3.5" +install: +- pip install -r requirements-dev.txt +script: +- python -c 'import bambam' +- flake8 *.py +- autopep8 -d *.py | awk 'BEGIN{had_data=0}{print;had_data=1}END{exit had_data}'