Commit e345bcd9 authored by Oskar Skog's avatar Oskar Skog

Pre 0.4.8: Added mk-symlinks for installing Python modules on the other versions

parent b393ba9e
......@@ -16,3 +16,5 @@ enginecfg.out
mkenginecfg.py
reconfigure
Makefile.vars
symlinks
......@@ -82,11 +82,12 @@ OSX_MK_ICON := $(srcdir)desktop/icon.icns.py
# make clean
ALL_STAGE := "$(MAIN_STAGE)" "$(OSX_WRAPPER)" "$(OSX_INFO_PLIST)" \
"$(OSX_ICON)" "$(builddir)check.py" "$(FD_DESKTOP_STAGE)" \
"$(ENGINECFG_STAGE)" "$(builddir)mkenginecfg.py"
"$(ENGINECFG_STAGE)" "$(builddir)mkenginecfg.py" \
"$(builddir)module-symlinks"
all : $(builddir)Makefile FORCE
@cd "$(builddir)" && $(MAKE) _all >/dev/null
_all : $(MAIN_STAGE) $(ENGINECFG_STAGE) $(srcdir)Makefile
_all : $(MAIN_STAGE) $(ENGINECFG_STAGE) $(builddir)module-symlinks
@if "$(freedesktop)"; then \
cd "$(builddir)" && $(MAKE) build-freedesktop >/dev/null; \
fi
......@@ -117,6 +118,11 @@ $(ENGINECFG_STAGE) : $(srcdir)mkenginecfg $(builddir)Makefile.vars
@"$(srcdir)mkenginecfg" "$(srcdir)" "$(builddir)" "$(HISCORE_FILE)"
$(builddir)module-symlinks : $(builddir)Makefile.vars $(srcdir)mk-symlinks
@python "$(srcdir)mk-symlinks" "$(srcdir)" "$(prefix)" "$(libdir)" \
"$(MODULES)" "$(DESTDIR)" "$(builddir)"
build-freedesktop : $(FD_DESKTOP_STAGE)
@: # Refer to desktop/README for information about the following.
@$(info) 'freedesktop.org stuff created'
......@@ -150,9 +156,9 @@ _clean : FORCE
distclean : $(builddir)Makefile FORCE
@cd "$(builddir)" && $(MAKE) _distclean >/dev/null
_distclean : _clean
@rm $(builddir)Makefile
@rm $(builddir)Makefile.vars
@rm $(builddir)reconfigure
@rm "$(builddir)Makefile"
@rm "$(builddir)Makefile.vars"
@rm "$(builddir)reconfigure"
##############################################################################
......
#!/usr/bin/python
import sys
import os
args={}
args['srcdir'] = sys.argv[1]
args['prefix'] = sys.argv[2]
args['libdir'] = sys.argv[3]
args['modules_dir'] = sys.argv[4]
args['destdir'] = sys.argv[5]
builddir = sys.argv[6]
out = r'''#!/usr/bin/python
import sys
import os
# Stop funny things from happening.
def usage():
sys.stderr.write(
"Usage: <python-implementation> symlinks {install|uninstall}\n"
"See INSTALL for further instructions.\n"
)
sys.exit(0)
if len(sys.argv) != 2:
usage()
if sys.argv[1] not in ('install', 'uninstall'):
usage()
sys.path.insert(0, $srcdir$)
import configure
Makefile = {
'prefix': $prefix$,
'libdir': $libdir$,
}
if configure.find_MODULES(Makefile, {'f': False, 'v': False, 'w': False,}):
sys.stderr.write("Failed to find a good module directory.\n")
sys.exit(1)
if configure.expand('MODULES', Makefile) == $modules_dir$:
sys.stderr.write("Same as default.\n")
sys.exit(0)
files = ("anonymine_engine.py", "anonymine_fields.py", "anonymine_solver.py")
for file in files:
srcfile = '{}/{}'.format($modules_dir$, file)
destfile = '{}{}/{}'.format(
$destdir$,
configure.expand('MODULES', Makefile),
file
)
# Don't remove real files.
# Only create links to real files.
# Real files are not symlinks.
if sys.argv[1] == "install":
sys.stderr.write('"{0}" -> "{1}"\n'.format(destfile, srcfile))
if not os.path.islink(srcfile):
try:
os.unlink(destfile)
except:
pass
os.symlink(srcfile, destfile)
else:
sys.stderr.write("Source file is a symlink.\n")
sys.exit(1)
else:
sys.stderr.write('Delete "{0}"\n'.format(destfile))
try:
os.stat(destfile)
except:
sys.stderr.write("Destination file does not exist.\n")
continue
if os.path.islink(destfile):
os.unlink(destfile)
else:
sys.stderr.write("Destination file is not a symlink.\n")
sys.exit(1)
'''
for arg in args:
out = out.replace(
'${0}$'.format(arg),
'"{0}"'.format(args[arg].replace('\\', '\\\\').replace('"', '\\"'))
)
outname = builddir + "symlinks"
outfile = open(outname, "w")
outfile.write(out)
outfile.close()
os.system("chmod +x '{0}'".format(outname.replace("'", "\'\"\'\"\'")))
......@@ -19,7 +19,7 @@ files="${NAME}.py ${NAME}_engine.py ${NAME}_fields.py ${NAME}_solver.py \
ChangeLog FAQ INSTALL NEWS README LICENSE desktop/FILES \
desktop/README RELEASE-NOTES INSTALL.Haiku \
configure check.sh desktop/desktop.sh desktop/${NAME}-*.png \
desktop/${NAME}*.xcf mkenginecfg mkdist"
desktop/${NAME}*.xcf mkenginecfg mkdist mk-symlinks"
......
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