Prepare for packaging

This commit is contained in:
Samuel Sloniker 2021-09-13 14:44:24 -07:00
parent 5a2802ddae
commit 39ff3a5672
4 changed files with 34 additions and 11 deletions

23
install.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
if [ "$1" == '' ]; then
target="/usr/local/"
elif [ -d "$1" ]; then
target=$1
else
echo "Error: if an argument is present, it must be a directory" >&2
exit 1
fi
if [ "$2" == '' ]; then
final_target=$target
else
final_target=$2
fi
mkdir -p $target/bin $target/share/wormpy
cp wormpy/*.py $target/share/wormpy
echo "#!/bin/bash" > $target/bin/wormpy
echo "python3 $final_target/share/wormpy/" >> $target/bin/wormpy
chmod +x $target/bin/wormpy

View File

@ -36,7 +36,7 @@ def draw_worm():
def draw_frame():
print(term.clear, end='')
print(do_move(0, 0) + term.on_red(' worm') + term.bright_cyan_on_red('.py ') + ' Press ' + term.bold_green('I') + ' for info, ' + term.bold_red('Ctrl-C')+ ' to quit', end='')
print(do_move(0, 0) + term.on_red(' Worm') + term.black_on_bright_cyan('.py ') + ' Press ' + term.bold_green('I') + ' for info, ' + term.bold_red('Ctrl-C')+ ' to quit', end='')
if score > -1:
print(do_move(0, width-12) + f'Score:{" "*(4-len(str(score)))}{term.bright_green(str(score))}', end='')
print(do_move(1, 0) + term.white_on_red('' + ('' * (width-3)) + ''), end='')
@ -166,7 +166,7 @@ def save_game():
term = Terminal()
gamesave_path = os.path.join(os.getenv('HOME'), '.worm.py-gamesave')
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(prog='wormpy')
group = parser.add_mutually_exclusive_group()
group.add_argument("--save-game", '-s', help="use 80x24 box and save game on ^C (default)", action='store_true', default=True)
group.add_argument("--full-screen", '-f', help="use entire screen (disables game saving)", action='store_true')
@ -203,7 +203,7 @@ elif args.full_screen:
else:
print("An unhandleable error occurred.")
print("The code was not expected to reach this state.")
print("Please create an issue at https://github.com/kj7rrv/worm.py/issues")
print("Please create an issue at https://github.com/kj7rrv/wormpy/issues")
sys.exit(2)
worm_y = height // 2

View File

@ -1,9 +1,9 @@
def get_infos(term, do_move, height, width, x_offset):
info_1 = term.clear() + do_move(0, 0) + term.on_red(' worm') \
+ term.bright_cyan_on_red('.py ') + f''' v1.0: bsdgames worm, ported \
info_1 = term.clear() + do_move(0, 0) + term.on_red(' Worm') \
+ term.black_on_bright_cyan('.py ') + f''' v1.0: bsdgames worm, ported \
to Python and improved
See https://github.com/kj7rrv/worm.py for source code and installation
See https://github.com/kj7rrv/wormpy for source code and installation
instructions.
Thanks to the authors of the following libraries:
@ -19,11 +19,11 @@ Use the arrow keys or WASD to move. Try to get the green numbers, but don't
let the worm run into itself or the red edge.
To change the initial length of the worm, add the desired length of the worm
after `{term.bright_red('worm')}{term.bright_cyan('.py')}`, as in \
`{term.bright_red('worm')}{term.bright_cyan('.py')} 20` for a twenty-character\
after `{term.bright_red('worm')}{term.bright_cyan('py')}`, as in \
`{term.bright_red('worm')}{term.bright_cyan('py')} 20` for a twenty-character\
-long worm.
{term.bright_red('worm')}{term.bright_cyan('.py')} is released under the MIT \
{term.bright_red('Worm')}{term.bright_cyan('.py')} is released under the MIT \
license.'''\
+ '{}Press {} to continue, {} to exit the game...'.format(
do_move(height - 1, 0),
@ -31,8 +31,8 @@ license.'''\
term.bold_red('Ctrl-C')
)
info_2 = term.clear() + do_move(0, 0) + term.on_red(' worm') \
+ term.bright_cyan_on_red('.py ') + f''' Copyright and License Info
info_2 = term.clear() + do_move(0, 0) + term.on_red(' Worm') \
+ term.black_on_bright_cyan('.py ') + f''' Copyright and License Info
Copyright (c) 2021 Samuel L. Sloniker