Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink source dist #108

Merged
merged 4 commits into from Jul 21, 2015
Merged

Shrink source dist #108

merged 4 commits into from Jul 21, 2015

Conversation

eriol
Copy link
Member

@eriol eriol commented Jul 21, 2015

Don't ship prebuilt documentation is a huge size saving. prune directive inside MANIFEST.in ensure prebuilt documentation is not shipped by mistake.

Without prune directive (with documentation built) python setup.py sdist (using current master) will produce:
❯ du -hs dist/circuits-dev.tar.gz
1.7M dist/circuits-dev.tar.gz

With prune directive:
❯ du -hs dist/circuits-dev.tar.gz
396K dist/circuits-dev.tar.gz

Ref: #78

wiki.zip diff follow (wiki-z is the code extracted from zip file):

Common subdirectories: wiki-z/defaultpages and wiki/defaultpages
Only in wiki: Dockerfile
Only in wiki: .gitignore
Common subdirectories: wiki-z/macros and wiki/macros
Only in wiki: requirements.txt
Only in wiki: setup.py
Common subdirectories: wiki-z/static and wiki/static
Common subdirectories: wiki-z/tpl and wiki/tpl
diff -u wiki-z/wiki.py wiki/wiki.py
--- wiki-z/wiki.py	2011-01-29 09:26:39.000000000 +0100
+++ wiki/wiki.py	2015-07-12 15:17:19.533037955 +0200
@@ -10,8 +10,11 @@

 import macros

-text2html = Parser(create_dialect(creole11_base, macro_func=macros.dispatcher),
-        method="xhtml")
+text2html = Parser(
+    create_dialect(creole11_base, macro_func=macros.dispatcher),
+    method="xhtml"
+)
+

 class Wiki(object):

@@ -33,11 +36,15 @@
         self._cu.execute("SELECT COUNT() FROM pages WHERE name=?", (name,))
         row = self._cu.fetchone()
         if row[0]:
-            self._cu.execute("UPDATE pages SET text=? WHERE name=?",
-                    (text, name,))
+            self._cu.execute(
+                "UPDATE pages SET text=? WHERE name=?",
+                (text, name,)
+            )
         else:
-            self._cu.execute("INSERT INTO pages (name, text) VALUES (?, ?)",
-                    (name, text,))
+            self._cu.execute(
+                "INSERT INTO pages (name, text) VALUES (?, ?)",
+                (name, text,)
+            )
         self._cx.commit()

     def get(self, name, default=None):
@@ -45,6 +52,7 @@
         row = self._cu.fetchone()
         return row[0] if row else default

+
 class Root(Controller):

     db = Wiki("wiki.db")
@@ -59,8 +67,7 @@
         d = {}
         d["title"] = name
         d["version"] = circuits.__version__
-        d["menu"] = text2html(self.db.get("SiteMenu", ""),
-                environ=environ)
+        d["menu"] = text2html(self.db.get("SiteMenu", ""), environ=environ)

         text = self.db.get(name, "")
         s = open("tpl/%s.html" % action, "r").read()
@@ -76,4 +83,8 @@
         self.db.save(name, form.get("text", ""))
         return self.redirect(name)

-(Server(("0.0.0.0", 8000)) + Static(docroot="static") + Root() + Logger()).run()
+app = Server(("0.0.0.0", 9000))
+Static(docroot="static").register(app)
+Root().register(app)
+Logger().register(app)
+app.run()
@prologic prologic merged commit 0baa1c9 into circuits:master Jul 21, 2015
@prologic
Copy link
Member

Thank you for this! :)

@eriol eriol deleted the shrink-source-dist branch July 21, 2015 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants