Fix zip files to make sense.

rtd2
Eric Holscher 2012-02-10 20:47:04 -08:00
parent b87a808914
commit 92d14b5fbf
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ media/pdf
media/export media/export
media/man media/man
media/epub media/epub
media/htmlzip
xml_output xml_output
locks/* locks/*
readthedocs/rtd_tests/tests/builds readthedocs/rtd_tests/tests/builds

View File

@ -141,6 +141,7 @@ class Builder(BaseBuilder):
self._changed = False self._changed = False
return build_results return build_results
@restoring_chdir
def _zip_html(self): def _zip_html(self):
from_path = self.version.project.full_build_path(self.version.slug) from_path = self.version.project.full_build_path(self.version.slug)
from_file = os.path.join(from_path, '%s.zip' % self.version.project.slug) from_file = os.path.join(from_path, '%s.zip' % self.version.project.slug)
@ -149,8 +150,9 @@ class Builder(BaseBuilder):
print "Creating zip file from %s" % from_path print "Creating zip file from %s" % from_path
# Create a <slug>.zip file containing all files in file_path # Create a <slug>.zip file containing all files in file_path
os.chdir(from_path)
archive = zipfile.ZipFile(to_file, 'w') archive = zipfile.ZipFile(to_file, 'w')
for root, subfolders, files in os.walk(from_path): for root, subfolders, files in os.walk('.'):
for file in files: for file in files:
archive.write(os.path.join(root, file)) archive.write(os.path.join(root, file))
archive.close() archive.close()