def _extract_django16_south_maas19(cls):
"""Extract the django16, south, and MAAS 1.9 source code in to a temp
path."""
path_to_tarball = cls._path_to_django16_south_maas19()
tempdir = tempfile.mkdtemp(prefix='maas-upgrade-')
subprocess.check_call([
"tar", "zxf", path_to_tarball, "-C", tempdir])
settings_json = os.path.join(tempdir, "maas19settings.json")
with open(settings_json, "w", encoding="utf-8") as fd:
fd.write(json.dumps({"DATABASES": settings.DATABASES}))
script_path = os.path.join(tempdir, "migrate.py")
with open(script_path, "wb") as fp:
fp.write(MAAS_UPGRADE_SCRIPT.encode("utf-8"))
return tempdir, script_path
评论列表
文章目录