Commit 0e5905c5 authored by Oskar Skog's avatar Oskar Skog

Test 0.2.22: Set CFGDIR in the main executable; Won at time formatting change

parent c2c752fa
2016-07-19 Oskar Skog <oskar.skog.finland@gmail.com>
0.2.22
* anonymine_engine.py (hiscores (display)): Www HH:MM goes back to
six days; Added "(Future)"
* configure.py, Makefile.static, anonymine.py, INSTALL: Allow
$(sysconfdir) to be anything.
2016-07-18 Oskar Skog <oskar.skog.finland@gmail.com>
0.2.21
* Makefile.static, anonymine.py, configure: Moved version numbering
......
......@@ -114,7 +114,7 @@ ADVANCED INSTALLATION
gamesdir $(prefix)/games
libdir $(prefix)/lib
localstatedir $(prefix)/var, /var
sysconfdir $(prefix)/etc, /etc # NOTE 2
sysconfdir $(prefix)/etc, /etc
vargamesdir $(localstatedir)/games, $(localstatedir)
EXECUTABLES This program will be installed in $(gamesdir)
......@@ -132,11 +132,7 @@ ADVANCED INSTALLATION
NOTE 1
gamesdir will override bindir if possible, so setting bindir
might have no effect
NOTE 2
The game itself only tests for sys.prefix+'/etc' and '/etc'.
./configure will fails if sysconfdir is not usable by the game.
might have no effect.
prefix, bindir and libdir, localstatedir, sysconfdir:
http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
......
......@@ -12,7 +12,7 @@
NAME := anonymine
NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing
VERSION := 0.2.21
VERSION := 0.2.22
# Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES, and MODULES_OTHERVER which may be set to "non-existent".
......@@ -49,7 +49,12 @@ info := test "$(verbose)" != true || echo '//'
MAIN_SRC := $(srcdir)$(NAME).py
MAIN_STAGE := $(builddir)$(NAME)
MAIN_DEST := $(DESTDIR)$(EXECUTABLES)/$(NAME)
SED_SCRIPT_MAIN_STAGE := s/MAKEFILE_GAME_VERSION/$(VERSION)/
CFG_DIR := $(DESTDIR)$(sysconfdir)/$(NAME)
MAIN_STAGE_SED1 := s/MAKEFILE_GAME_VERSION/$(VERSION)/
SED_CFGDIR := `echo $(CFG_DIR) | sed -e 's/\\//\\\\\\//g'`
MAIN_STAGE_SED2 := s/MAKEFILE_CFGDIR/$(SED_CFGDIR)/
HISCORE_FILE := $(DESTDIR)$(vargamesdir)/anonymine
ENGINECFG_STAGE := $(builddir)enginecfg.out
......@@ -88,7 +93,8 @@ all : $(MAIN_STAGE) $(ENGINECFG_STAGE)
$(MAIN_STAGE) : $(MAIN_SRC)
@$(info) 'Creating the appropriate shebang line'
@echo "#!`which python`" > "$(MAIN_STAGE)"
@sed -e "$(SED_SCRIPT_MAIN_STAGE)" "$(MAIN_SRC)" >> "$(MAIN_STAGE)"
@sed -e "$(MAIN_STAGE_SED1)" "$(MAIN_SRC)" \
| sed -e "$(MAIN_STAGE_SED2)" >> "$(MAIN_STAGE)"
$(ENGINECFG_STAGE) : $(srcdir)mkenginecfg
@$(info) 'Making enginecfg: mostly counting processors'
......@@ -118,7 +124,6 @@ INSTALL ?= install
INSTALL_CFG := python "$(srcdir)install-cfg" "$(INSTALL)"
CFG_DIR := $(DESTDIR)$(sysconfdir)/$(NAME)
# Modules: FOO_SRC, FOO_DEST, FOO_DEST_OTHERVER
ENGINE_SRC := $(srcdir)$(NAME)_engine.py
ENGINE_DEST := $(DESTDIR)$(MODULES)/$(NAME)_engine.py
......
......@@ -1370,6 +1370,7 @@ def main():
else:
locations = (
os.path.expanduser('~/.' + GAME_FILENAME + '/' + cfgfile),
"MAKEFILE_CFGDIR" + '/' + cfgfile,
sys.prefix + '/etc/' + GAME_FILENAME + '/' + cfgfile,
'/etc/' + GAME_FILENAME + '/' + cfgfile,
)
......
......@@ -322,8 +322,10 @@ class hiscores():
def format_wontime(t):
# Does not need to be precise, anything less than a week is good.
if time.time() - t < 300000:
if time.time() - t < 518400:
return time.strftime('%a %H:%M', time.localtime(t))
elif time.time() - t < 0:
return '(Future)'
else:
return time.strftime('%Y-%m-%d', time.localtime(t))
......
......@@ -282,19 +282,14 @@ def find_sysconfdir(Makefile, flags):
Depends on $(prefix)
'''
if 'sysconfdir' in Makefile:
if expand('sysconfdir', Makefile) not in ('/etc', sys.prefix+'/etc'):
sys.stderr.write('Will not be able to find configuration\n')
return True
else:
return False
return False
else:
if Makefile['prefix'] == sys.prefix:
try:
os.listdir(expand('prefix', Makefile) + '/etc')
Makefile['sysconfdir'] = '$(prefix)/etc'
return False
except:
pass
try:
os.listdir(expand('prefix', Makefile) + '/etc')
Makefile['sysconfdir'] = '$(prefix)/etc'
return False
except:
pass
Makefile['sysconfdir'] = '/etc'
return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment