summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@torproject.org>2011-10-20 10:06:56 -0300
committerTomás Touceda <chiiph@torproject.org>2011-10-20 10:06:56 -0300
commit15de7549fbc0d9ea111710e6a3d46c74cd76ab67 (patch)
treef06171e96d82dec86d9351f6043ff0167e5e724b
parent48cdba812c660fccd16052f7f2119b867a736ec2 (diff)
Use the tmp dir just for the metadata
-rw-r--r--lib/thandy/ThpCLI.py30
1 files 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()