summaryrefslogtreecommitdiff
path: root/backend/resilient/__init__.py
diff options
context:
space:
mode:
authorIkiWiki <ikiwiki.info>2019-09-02 12:54:51 -0400
committerIkiWiki <ikiwiki.info>2019-09-02 12:54:51 -0400
commitb52aedc76701b3e42acdb34ad2513b119dbaf7e0 (patch)
treebea6de0c0859ed01bcd86c9686ec82f60f540b42 /backend/resilient/__init__.py
parent2229373c28c119b5d7fdaa2b35dec5aa8f0adade (diff)
downloadstandingwithresilience-b52aedc76701b3e42acdb34ad2513b119dbaf7e0.tar.gz
standingwithresilience-b52aedc76701b3e42acdb34ad2513b119dbaf7e0.zip
work towards referencing bsv
Diffstat (limited to 'backend/resilient/__init__.py')
-rw-r--r--backend/resilient/__init__.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py
index dfab073..73e375c 100644
--- a/backend/resilient/__init__.py
+++ b/backend/resilient/__init__.py
@@ -4,7 +4,6 @@
# git saves history
# ikiwiki connects git to online presentation and collaboration
-import fileinput
import os
import shlex
import shutil
@@ -14,7 +13,7 @@ import tempfile
import time
import urllib
-__all__ = ["freenet"]
+__all__ = ["freenet", "bsv_metanet"]
backend_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
root_path = os.path.normpath(os.path.join(backend_path, '..'))
@@ -44,11 +43,14 @@ class git:
found = (os.system("git status --porcelain") == 0)
if not found:
print("ERROR: git not found")
- # TODO; download git, place in dep_path, and run from there
+ # TODO: download git, place in dep_path, and run from there
exit(1)
+ orig_dir = os.path.abspath(".")
+ os.chdir(root_path)
os.system("git submodule init")
os.system("git submodule update")
+ os.chdir(orig_dir)
# http://stackoverflow.com/questions/1964470/whats-the-equivalent-of-use-commit-times-for-git
# sets mtimes to last commit time, for ikiwiki 'last edited by' time
@@ -100,10 +102,18 @@ class git:
class ikiwiki:
- found = (os.system("ikiwiki --version") == 0)
+ binary = "ikiwiki"
+ found = (os.system("%s --version" % binary) == 0)
if not found:
- print("WARNING: ikiwiki not found. please add code to fetch and build the backend/dep/ikiwiki submodule.")
-
+ binary = "%s/ikiwiki/ikiwiki.out" % dep_path
+ os.environ['PERL5LIB'] += os.pathsep + os.path.join(dep_path, 'ikiwiki')
+ found = (os.system("%s --version" % binary) == 0)
+ if not found:
+ print("ikiwiki not found: attempting to build")
+ os.system("%s/build_ikiwiki.sh" % dep_path)
+ found = (os.system("%s --version" % binary) == 0)
+ if not found:
+ print("WARNING: ikiwiki not found. did build fail on this platform?")
synced = False
def push(self):
@@ -116,13 +126,17 @@ class ikiwiki:
shutil.rmtree(html_path)
os.system("git checkout -- '%s'" % html_path)
- status = os.system("ikiwiki --setup '%s' '%s' '%s'" % (ikiwiki_setup_path, wiki_src_path, html_path))
+ status = os.system("%s --setup '%s' '%s' '%s'" % (ikiwiki.binary, ikiwiki_setup_path, wiki_src_path, html_path))
ikiwiki.synced = (status == 0)
if ikiwiki.synced:
os.system('git gc')
os.system('git update-server-info')
- html_git_path = os.path.join(html_path, '.git')
+
+ # /.git folder access can be seen as security access problem by web hosts, so alias to /git
+ with open(os.path.join(html_path, ".git"), "w") as f: f.write("gitdir: ./git")
+
+ html_git_path = os.path.join(html_path, 'git')
os.mkdir(html_git_path)
for path in ['objects', 'refs', 'HEAD', 'info', 'packed-refs']:
git_subpath = os.path.join(git_path, path)