aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornemysis <nemysis@FreeBSD.org>2014-04-09 05:05:09 +0800
committernemysis <nemysis@FreeBSD.org>2014-04-09 05:05:09 +0800
commit47c12dc71d45dd974f7407ffa76417f68778fc47 (patch)
tree045e80833a11332091f9a6342bb7264a45e31e07
parenta6f55a3818dd4999f488a38f3c1776686e37e40d (diff)
downloadfreebsd-ports-gnome-47c12dc71d45dd974f7407ffa76417f68778fc47.tar.gz
freebsd-ports-gnome-47c12dc71d45dd974f7407ffa76417f68778fc47.tar.zst
freebsd-ports-gnome-47c12dc71d45dd974f7407ffa76417f68778fc47.zip
- Bump PORTREVISION
- Transfer maintainership to games@ team - Use PYGAME instead of PYTHON_SITELIBDIR - Remove NO_BUILD=yes - Change DOCS, add Option - Use supplied icons, add INSTALLS_ICONS=yes and ICON_SIZES - Add pkg-message, information about config file, add 4stattack.desktop and 4stattack.in - Remove obsolete REINPLACE, add for icons - Simplify installation handling and port - Remove obsolete patch files/patch-4stattack and scripts/py-compile - Recreate pkg-plist with make makeplist, remove DOCS, add icons
-rw-r--r--games/4stattack/Makefile265
-rw-r--r--games/4stattack/files/4stattack.desktop9
-rw-r--r--games/4stattack/files/4stattack.in7
-rw-r--r--games/4stattack/files/patch-4stattack15
-rw-r--r--games/4stattack/files/pkg-message.in21
-rw-r--r--games/4stattack/pkg-plist18
-rw-r--r--games/4stattack/scripts/py-compile92
7 files changed, 85 insertions, 342 deletions
diff --git a/games/4stattack/Makefile b/games/4stattack/Makefile
index 1734dec31190..f2446d01ecc5 100644
--- a/games/4stattack/Makefile
+++ b/games/4stattack/Makefile
@@ -3,251 +3,60 @@
PORTNAME= 4stattack
PORTVERSION= 2.1.4
-PORTREVISION= 9
+PORTREVISION= 10
CATEGORIES= games
-MASTER_SITES= SF/forcedattack/4stAttack/${PORTVERSION}
+MASTER_SITES= SF/forcedattack/4stAttack/${PORTVERSION}/
DISTNAME= 4stAttack-${PORTVERSION}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= games@FreeBSD.org
COMMENT= Connect four stones in a straight line
LICENSE= GPLv2
-RUN_DEPENDS= ${PYTHON_SITELIBDIR}/pygame/__init__.py:${PORTSDIR}/devel/py-game
+RUN_DEPENDS= ${PYGAME}
USE_PYTHON= yes
-NO_BUILD= yes
+PORTDOCS= changelog.txt credits.txt
OPTIONS_DEFINE= DOCS
-PYC= PYTHON="${PYTHON_CMD}" ${SH} ${SCRIPTDIR}/py-compile
+INSTALLS_ICONS= yes
+ICON_SIZES= 16x16 22x22 32x32 48x48 64x64
-post-patch:
- @${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|; s|%%PYTHON%%|${PYTHON_CMD}|' \
- ${WRKSRC}/4stattack
-
-do-install:
- @${MKDIR} ${STAGEDIR}${PREFIX}/bin
- ${INSTALL_SCRIPT} \
- ${WRKSRC}/4stattack \
- ${STAGEDIR}${PREFIX}/bin
-
- @${MKDIR} ${STAGEDIR}${DATADIR}
- ${INSTALL_DATA} \
- ${WRKSRC}/4stattack.py \
- ${WRKSRC}/animator.py \
- ${WRKSRC}/board.py \
- ${WRKSRC}/chat.py \
- ${WRKSRC}/creditsscreen.py \
- ${WRKSRC}/endgamedialog.py \
- ${WRKSRC}/endscreen.py \
- ${WRKSRC}/game.py \
- ${WRKSRC}/gamelog.py \
- ${WRKSRC}/gamescreen.py \
- ${WRKSRC}/inisettings.py \
- ${WRKSRC}/multiplayerscreen.py \
- ${WRKSRC}/quit.py \
- ${WRKSRC}/rules.py \
- ${WRKSRC}/scoremap.py \
- ${WRKSRC}/setini.py \
- ${WRKSRC}/settings.ini \
- ${WRKSRC}/settingsscreen.py \
- ${WRKSRC}/startscreen.py \
- ${WRKSRC}/technical.ttf \
- ${WRKSRC}/testgui.py \
- ${WRKSRC}/testini.py \
- ${WRKSRC}/themeresizer.py \
- ${WRKSRC}/themeresizer.sh \
- ${WRKSRC}/version \
- ${STAGEDIR}${DATADIR}
- ${PYC} --basedir ${DATADIR} \
- ${STAGEDIR}${DATADIR}/4stattack.py \
- ${STAGEDIR}${DATADIR}/animator.py \
- ${STAGEDIR}${DATADIR}/board.py \
- ${STAGEDIR}${DATADIR}/chat.py \
- ${STAGEDIR}${DATADIR}/creditsscreen.py \
- ${STAGEDIR}${DATADIR}/endgamedialog.py \
- ${STAGEDIR}${DATADIR}/endscreen.py \
- ${STAGEDIR}${DATADIR}/game.py \
- ${STAGEDIR}${DATADIR}/gamelog.py \
- ${STAGEDIR}${DATADIR}/gamescreen.py \
- ${STAGEDIR}${DATADIR}/inisettings.py \
- ${STAGEDIR}${DATADIR}/multiplayerscreen.py \
- ${STAGEDIR}${DATADIR}/quit.py \
- ${STAGEDIR}${DATADIR}/rules.py \
- ${STAGEDIR}${DATADIR}/scoremap.py \
- ${STAGEDIR}${DATADIR}/setini.py \
- ${STAGEDIR}${DATADIR}/settingsscreen.py \
- ${STAGEDIR}${DATADIR}/startscreen.py \
- ${STAGEDIR}${DATADIR}/testgui.py \
- ${STAGEDIR}${DATADIR}/testini.py \
- ${STAGEDIR}${DATADIR}/themeresizer.py
-
- @${MKDIR} ${STAGEDIR}${DATADIR}/data/music
- ${INSTALL_DATA} \
- ${WRKSRC}/data/music/4stattack.ogg \
- ${STAGEDIR}${DATADIR}/data/music
+SUB_FILES= ${PORTNAME} pkg-message
- @${MKDIR} ${STAGEDIR}${DATADIR}/data/themes/clean
- ${INSTALL_DATA} \
- ${WRKSRC}/data/themes/clean/audio.ini \
- ${WRKSRC}/data/themes/clean/graphics.ini \
- ${STAGEDIR}${DATADIR}/data/themes/clean
-
- @${MKDIR} ${STAGEDIR}${DATADIR}/data/themes/clean/1024x768
- ${INSTALL_DATA} \
- ${WRKSRC}/data/themes/clean/1024x768/awaitingconnection.png \
- ${WRKSRC}/data/themes/clean/1024x768/back.png \
- ${WRKSRC}/data/themes/clean/1024x768/background.png \
- ${WRKSRC}/data/themes/clean/1024x768/chakie.png \
- ${WRKSRC}/data/themes/clean/1024x768/connecting-plain.png \
- ${WRKSRC}/data/themes/clean/1024x768/connecting.png \
- ${WRKSRC}/data/themes/clean/1024x768/credits.png \
- ${WRKSRC}/data/themes/clean/1024x768/cursor.png \
- ${WRKSRC}/data/themes/clean/1024x768/draw.png \
- ${WRKSRC}/data/themes/clean/1024x768/error-connecting.png \
- ${WRKSRC}/data/themes/clean/1024x768/frame.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_bl.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_br.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_left.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_right.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_tl.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_top.png \
- ${WRKSRC}/data/themes/clean/1024x768/frm_tr.png \
- ${WRKSRC}/data/themes/clean/1024x768/fullscreen.png \
- ${WRKSRC}/data/themes/clean/1024x768/graphics.png \
- ${WRKSRC}/data/themes/clean/1024x768/green-zebra.png \
- ${WRKSRC}/data/themes/clean/1024x768/grid.png \
- ${WRKSRC}/data/themes/clean/1024x768/hostagame.png \
- ${WRKSRC}/data/themes/clean/1024x768/joinagame.png \
- ${WRKSRC}/data/themes/clean/1024x768/keepplaying.png \
- ${WRKSRC}/data/themes/clean/1024x768/korruptor.png \
- ${WRKSRC}/data/themes/clean/1024x768/locations.ini \
- ${WRKSRC}/data/themes/clean/1024x768/logo.png \
- ${WRKSRC}/data/themes/clean/1024x768/multiplayer.png \
- ${WRKSRC}/data/themes/clean/1024x768/music.png \
- ${WRKSRC}/data/themes/clean/1024x768/ok.png \
- ${WRKSRC}/data/themes/clean/1024x768/playervscpu.png \
- ${WRKSRC}/data/themes/clean/1024x768/programming.png \
- ${WRKSRC}/data/themes/clean/1024x768/pygame.png \
- ${WRKSRC}/data/themes/clean/1024x768/quit.png \
- ${WRKSRC}/data/themes/clean/1024x768/quitgame.png \
- ${WRKSRC}/data/themes/clean/1024x768/radio-off.png \
- ${WRKSRC}/data/themes/clean/1024x768/radio-on.png \
- ${WRKSRC}/data/themes/clean/1024x768/radio.png \
- ${WRKSRC}/data/themes/clean/1024x768/selector.png \
- ${WRKSRC}/data/themes/clean/1024x768/selector1.png \
- ${WRKSRC}/data/themes/clean/1024x768/selector2.png \
- ${WRKSRC}/data/themes/clean/1024x768/settings.png \
- ${WRKSRC}/data/themes/clean/1024x768/slm-text.png \
- ${WRKSRC}/data/themes/clean/1024x768/slm.png \
- ${WRKSRC}/data/themes/clean/1024x768/start.png \
- ${WRKSRC}/data/themes/clean/1024x768/stone_1.png \
- ${WRKSRC}/data/themes/clean/1024x768/stone_2.png \
- ${WRKSRC}/data/themes/clean/1024x768/thanks.png \
- ${WRKSRC}/data/themes/clean/1024x768/wannaquit.png \
- ${WRKSRC}/data/themes/clean/1024x768/won_1.png \
- ${WRKSRC}/data/themes/clean/1024x768/won_2.png \
- ${STAGEDIR}${DATADIR}/data/themes/clean/1024x768
-
- @${MKDIR} ${STAGEDIR}${DATADIR}/gui
- ${INSTALL_DATA} \
- ${WRKSRC}/gui/__init__.py \
- ${WRKSRC}/gui/button.py \
- ${WRKSRC}/gui/canvas.py \
- ${WRKSRC}/gui/checkbox.py \
- ${WRKSRC}/gui/dialog.py \
- ${WRKSRC}/gui/editfield.py \
- ${WRKSRC}/gui/fader.py \
- ${WRKSRC}/gui/image.py \
- ${WRKSRC}/gui/label.py \
- ${WRKSRC}/gui/messagebox.py \
- ${WRKSRC}/gui/progress.py \
- ${WRKSRC}/gui/widget.py \
- ${WRKSRC}/gui/widget_manager.py \
- ${STAGEDIR}${DATADIR}/gui
- ${PYC} --basedir ${DATADIR}/gui \
- ${STAGEDIR}${DATADIR}/gui/__init__.py \
- ${STAGEDIR}${DATADIR}/gui/button.py \
- ${STAGEDIR}${DATADIR}/gui/canvas.py \
- ${STAGEDIR}${DATADIR}/gui/checkbox.py \
- ${STAGEDIR}${DATADIR}/gui/dialog.py \
- ${STAGEDIR}${DATADIR}/gui/editfield.py \
- ${STAGEDIR}${DATADIR}/gui/fader.py \
- ${STAGEDIR}${DATADIR}/gui/image.py \
- ${STAGEDIR}${DATADIR}/gui/label.py \
- ${STAGEDIR}${DATADIR}/gui/messagebox.py \
- ${STAGEDIR}${DATADIR}/gui/progress.py \
- ${STAGEDIR}${DATADIR}/gui/widget.py \
- ${STAGEDIR}${DATADIR}/gui/widget_manager.py
+post-patch:
+.for s in 16 22 32 48 64
+ @cd ${WRKSRC}/kde/icons/${s}x${s} ; \
+ ${MV} forcedattack2.png ${PORTNAME}_${s}x${s}.png
+.endfor
- @${MKDIR} ${STAGEDIR}${DATADIR}/gui/dialogs
- ${INSTALL_DATA} \
- ${WRKSRC}/gui/dialogs/dialog \
- ${WRKSRC}/gui/dialogs/end_game.py \
- ${WRKSRC}/gui/dialogs/info_map.py \
- ${WRKSRC}/gui/dialogs/info_scenario.py \
- ${WRKSRC}/gui/dialogs/info_units.py \
- ${WRKSRC}/gui/dialogs/main_dialog.py \
- ${WRKSRC}/gui/dialogs/new_game.py \
- ${WRKSRC}/gui/dialogs/select_scenario.py \
- ${WRKSRC}/gui/dialogs/setup_client.py \
- ${WRKSRC}/gui/dialogs/setup_network.py \
- ${WRKSRC}/gui/dialogs/setup_players.py \
- ${WRKSRC}/gui/dialogs/start_game.py \
- ${WRKSRC}/gui/dialogs/wait_client.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs
- ${PYC} --basedir ${DATADIR}/gui/dialogs \
- ${STAGEDIR}${DATADIR}/gui/dialogs/end_game.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/info_map.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/info_scenario.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/info_units.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/main_dialog.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/new_game.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/select_scenario.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/setup_client.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/setup_network.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/setup_players.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/start_game.py \
- ${STAGEDIR}${DATADIR}/gui/dialogs/wait_client.py
+do-build:
+ @${PYTHON_CMD} -m compileall ${WRKSRC}
+ @${PYTHON_CMD} -O -m compileall ${WRKSRC}
- @${MKDIR} ${STAGEDIR}${DATADIR}/players
- ${INSTALL_DATA} \
- ${WRKSRC}/players/__init__.py \
- ${WRKSRC}/players/agressive.py \
- ${WRKSRC}/players/connectscore.py \
- ${WRKSRC}/players/human.py \
- ${WRKSRC}/players/minmax.py \
- ${WRKSRC}/players/multiplayer.py \
- ${WRKSRC}/players/multiplayer_receiver.py \
- ${WRKSRC}/players/multiplayer_sender.py \
- ${WRKSRC}/players/neuralai.py \
- ${WRKSRC}/players/player.py \
- ${WRKSRC}/players/randomai.py \
- ${WRKSRC}/players/strategic.py \
- ${WRKSRC}/players/treeai.py \
- ${WRKSRC}/players/weighted.py \
- ${STAGEDIR}${DATADIR}/players
- ${PYC} --basedir ${DATADIR}/players \
- ${STAGEDIR}${DATADIR}/players/__init__.py \
- ${STAGEDIR}${DATADIR}/players/agressive.py \
- ${STAGEDIR}${DATADIR}/players/connectscore.py \
- ${STAGEDIR}${DATADIR}/players/human.py \
- ${STAGEDIR}${DATADIR}/players/minmax.py \
- ${STAGEDIR}${DATADIR}/players/multiplayer.py \
- ${STAGEDIR}${DATADIR}/players/multiplayer_receiver.py \
- ${STAGEDIR}${DATADIR}/players/multiplayer_sender.py \
- ${STAGEDIR}${DATADIR}/players/neuralai.py \
- ${STAGEDIR}${DATADIR}/players/player.py \
- ${STAGEDIR}${DATADIR}/players/randomai.py \
- ${STAGEDIR}${DATADIR}/players/strategic.py \
- ${STAGEDIR}${DATADIR}/players/treeai.py \
- ${STAGEDIR}${DATADIR}/players/weighted.py
+do-install:
+ @${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' \
+ ${WRKDIR}/${PORTNAME}
+ ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
+ @(cd ${WRKSRC} && ${COPYTREE_SHARE} "data gui players" ${STAGEDIR}${DATADIR})
+.for f in *.py *.pyc *.pyo
+ ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+.for f in settings.ini *.ttf *.sh version
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+ ${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.desktop ${STAGEDIR}${DESKTOPDIR}
+
+.for s in ${ICON_SIZES}
+ @${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/${s}/apps/
+ ${INSTALL_DATA} ${WRKSRC}/kde/icons/${s}/${PORTNAME}_${s}.png \
+ ${STAGEDIR}${PREFIX}/share/icons/hicolor/${s}/apps/${PORTNAME}.png
+.endfor
+ ${LN} -sf ${PREFIX}/share/icons/hicolor/48x48/apps/${PORTNAME}.png \
+ ${STAGEDIR}${PREFIX}/share/pixmaps/
@${MKDIR} ${STAGEDIR}${DOCSDIR}
- ${INSTALL_DATA} \
- ${WRKSRC}/changelog.txt \
- ${WRKSRC}/credits.txt \
- ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>
diff --git a/games/4stattack/files/4stattack.desktop b/games/4stattack/files/4stattack.desktop
new file mode 100644
index 000000000000..f35f5ff6d81f
--- /dev/null
+++ b/games/4stattack/files/4stattack.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=4st Attack
+GenericName=4st Attack game
+Comment=Connect four stones in a straight line
+Icon=4stattack
+Exec=4stattack
+Categories=Game;StrategyGame;
diff --git a/games/4stattack/files/4stattack.in b/games/4stattack/files/4stattack.in
new file mode 100644
index 000000000000..ddc0e7f9a06b
--- /dev/null
+++ b/games/4stattack/files/4stattack.in
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+cd "%%DATADIR%%"
+exec %%PYTHON_CMD%% ./4stattack.py -ini ~/.4stattackrc "${@}"
diff --git a/games/4stattack/files/patch-4stattack b/games/4stattack/files/patch-4stattack
deleted file mode 100644
index 1460ed076906..000000000000
--- a/games/4stattack/files/patch-4stattack
+++ /dev/null
@@ -1,15 +0,0 @@
---- 4stattack.orig Mon Jan 26 08:08:08 2004
-+++ 4stattack Mon Jan 26 08:28:42 2004
-@@ -1,9 +1,6 @@
- #!/bin/sh
--FAHOME=/usr/share/forcedattack2
-+FAHOME=%%DATADIR%%
- if [ ! -f ~/.4stattackrc ]; then
-- cp $FAHOME/settings.ini ~/.4stattackrc
-+ install -m 644 $FAHOME/settings.ini ~/.4stattackrc
- fi
--if [ -x $FAHOME/4stattack.py ]; then
-- $FAHOME/4stattack.py -ini ~/.4stattackrc
--fi
--
-+cd $FAHOME && %%PYTHON%% 4stattack.py -ini ~/.4stattackrc
diff --git a/games/4stattack/files/pkg-message.in b/games/4stattack/files/pkg-message.in
new file mode 100644
index 000000000000..18957e7d9f40
--- /dev/null
+++ b/games/4stattack/files/pkg-message.in
@@ -0,0 +1,21 @@
+===============================================================================
+
+4st Attack has been installed.
+
+All options are given only in the config file.
+
+Please copy settings.ini to your home directory and adjust it
+
+ su user
+
+ cp %%DATADIR%%/settings.ini ~/.4stattackrc
+
+You could manually change Permissions with:
+
+ /bin/chmod 644 ~/.4stattackrc
+
+ exit
+
+Have fun!
+
+===============================================================================
diff --git a/games/4stattack/pkg-plist b/games/4stattack/pkg-plist
index a3f215d1b593..7354c713367d 100644
--- a/games/4stattack/pkg-plist
+++ b/games/4stattack/pkg-plist
@@ -239,15 +239,19 @@ bin/4stattack
%%DATADIR%%/themeresizer.pyo
%%DATADIR%%/themeresizer.sh
%%DATADIR%%/version
-%%PORTDOCS%%%%DOCSDIR%%/changelog.txt
-%%PORTDOCS%%%%DOCSDIR%%/credits.txt
-@dirrm %%DATADIR%%/data/music
+share/applications/4stattack.desktop
+share/icons/hicolor/16x16/apps/4stattack.png
+share/icons/hicolor/22x22/apps/4stattack.png
+share/icons/hicolor/32x32/apps/4stattack.png
+share/icons/hicolor/48x48/apps/4stattack.png
+share/icons/hicolor/64x64/apps/4stattack.png
+share/pixmaps/4stattack.png
+@dirrm %%DATADIR%%/players
+@dirrm %%DATADIR%%/gui/dialogs
+@dirrm %%DATADIR%%/gui
@dirrm %%DATADIR%%/data/themes/clean/1024x768
@dirrm %%DATADIR%%/data/themes/clean
@dirrm %%DATADIR%%/data/themes
+@dirrm %%DATADIR%%/data/music
@dirrm %%DATADIR%%/data
-@dirrm %%DATADIR%%/gui/dialogs
-@dirrm %%DATADIR%%/gui
-@dirrm %%DATADIR%%/players
@dirrm %%DATADIR%%
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
diff --git a/games/4stattack/scripts/py-compile b/games/4stattack/scripts/py-compile
deleted file mode 100644
index a055fae4f527..000000000000
--- a/games/4stattack/scripts/py-compile
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-
-# py-compile - Compile a Python program
-# Copyright 2000, 2001 Free Software Foundation, Inc.
-
-# 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 2, 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# called as "py-compile [--basedir DIR] PY_FILES ...
-
-if [ -z "$PYTHON" ]; then
- PYTHON=python
-fi
-
-basedir=
-
-case "$1" in
- --basedir)
- basedir=$2
- shift 2
- ;;
- --help)
- echo "Usage: py-compile [--basedir DIR] PY_FILES ..."
- echo "Byte compile some python scripts. This should be performed"
- echo "after they have been moved to the final installation location"
- exit 0
- ;;
- --version)
- echo "py-compile version 0.0"
- exit 0
- ;;
-esac
-
-if [ $# = 0 ]; then
- echo "No files given to $0" 1>&2
- exit 1
-fi
-
-# if basedir was given, then it should be prepended to filenames before
-# byte compilation.
-if [ -z "$basedir" ]; then
- trans="path = file"
-else
- trans="path = os.path.join('$basedir', file)"
-fi
-
-$PYTHON -c "
-import sys, os, string, py_compile
-
-files = '''$*'''
-print 'Byte-compiling python modules...'
-for file in string.split(files):
- $trans
- if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
- continue
- print file,
- sys.stdout.flush()
- py_compile.compile(path)
-print" || exit $?
-
-# this will fail for python < 1.5, but that doesn't matter ...
-$PYTHON -O -c "
-import sys, os, string, py_compile
-
-files = '''$*'''
-print 'Byte-compiling python modules (optimised versions) ...'
-for file in string.split(files):
- $trans
- if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
- continue
- print file,
- sys.stdout.flush()
- py_compile.compile(path)
-print" 2>/dev/null || :
-