From 15de7549fbc0d9ea111710e6a3d46c74cd76ab67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 20 Oct 2011 10:06:56 -0300 Subject: Use the tmp dir just for the metadata --- lib/thandy/ThpCLI.py | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/lib/thandy/ThpCLI.py b/lib/thandy/ThpCLI.py index 52938d6..77d9be5 100644 --- a/lib/thandy/ThpCLI.py +++ b/lib/thandy/ThpCLI.py @@ -40,29 +40,9 @@ def makethppackage(args): metadata = thandy.formats.makeThpPackageObj(configFile, dataPath) print "Generating directory structure..." - try: - os.mkdir(os.path.join(tmpPath, "meta")); - except Exception as e: - print e - thandy.util.deltree(tmpPath) - sys.exit(1) - - thandy.util.replaceFile(os.path.join(tmpPath, "meta", "package.json"), - json.dumps(metadata, indent=3)) - - shutil.copytree(dataPath, os.path.join(tmpPath, "content")) - if "scripts" in metadata: - try: - os.mkdir(os.path.join(tmpPath, "meta", "scripts")) - except Exception as e: - print e - thandy.util.deltree(tmpPath) - sys.exit(1) - for lang in metadata["scripts"]: - for script in metadata['scripts'][lang]: - shutil.copyfile(os.path.join(scriptsPath, script[0]), - os.path.join(tmpPath, "meta", "scripts", script[0])) + thandy.util.replaceFile(os.path.join(tmpPath, "package.json"), + json.dumps(metadata, indent=3)) thpFileName = "%s-%s.thp" % (metadata['package_name'], metadata['package_version']) @@ -72,16 +52,16 @@ def makethppackage(args): thpFileName), "w") for file in metadata['manifest']: - thpFile.write(os.path.join(tmpPath, "content", file['name']), + thpFile.write(os.path.join(dataPath, file['name']), os.path.join("content", file['name'])) if "scripts" in metadata: for lang in metadata["scripts"]: for script in metadata['scripts'][lang]: - thpFile.write(os.path.join(tmpPath, "meta", "scripts", script[0]), + thpFile.write(os.path.join(scriptsPath, script[0]), os.path.join("meta", "scripts", script[0])) - thpFile.write(os.path.join(tmpPath, "meta", "package.json"), + thpFile.write(os.path.join(tmpPath, "package.json"), os.path.join("meta", "package.json")) thpFile.close() -- cgit v1.2.3