Skip to content

Commit

Permalink
Merge pull request BSVino#22 from linkmauve/zipfile
Browse files Browse the repository at this point in the history
Replace the calls to external programs with the builtin ZipFile API
  • Loading branch information
BSVino committed Jun 5, 2015
2 parents c516b42 + 8c6c66e commit dc28d80
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import argparse
import re
import zipfile

import opengl
import shared
Expand Down Expand Up @@ -569,9 +570,9 @@ def replace_alias(matchobj):

print "Wrote " + str(written) + " commands for " + version

if platform.system() is "Windows":
subprocess.call(["\\Program Files\\7-Zip\\7z.exe", "a", "-tzip", "docs.gl.zip", "htdocs"])
else:
subprocess.call(["/usr/bin/zip", "-r", "docs.gl.zip", "htdocs" ])
with zipfile.ZipFile('docs.gl.zip', 'w', compression=zipfile.ZIP_DEFLATED) as docs_gl_zip:
for dirname, _, files in os.walk('htdocs'):
for filename in files:
docs_gl_zip.write(os.path.join(dirname, filename))

shutil.move("docs.gl.zip", "htdocs/")

0 comments on commit dc28d80

Please sign in to comment.