Downloads pyload source from bitbucket tip or given rev
(options)
| 110 | ("clean", 'c', 'Delete old source folder') |
| 111 | ]) |
| 112 | def get_source(options): |
| 113 | """ Downloads pyload source from bitbucket tip or given rev""" |
| 114 | if options.rev: options.url = "https://bitbucket.org/spoob/pyload/get/%s.zip" % options.rev |
| 115 | |
| 116 | pyload = path("pyload") |
| 117 | |
| 118 | if len(pyload.listdir()) and not options.clean: |
| 119 | return |
| 120 | elif pyload.exists(): |
| 121 | pyload.rmtree() |
| 122 | |
| 123 | urlretrieve(options.src, "pyload_src.zip") |
| 124 | zip = ZipFile("pyload_src.zip") |
| 125 | zip.extractall() |
| 126 | path("pyload_src.zip").remove() |
| 127 | |
| 128 | folder = [x for x in path(".").dirs() if x.name.startswith("spoob-pyload-")][0] |
| 129 | folder.move(pyload) |
| 130 | |
| 131 | change_mode(pyload, 0644) |
| 132 | change_mode(pyload, 0755, folder=True) |
| 133 | |
| 134 | for file in pyload.files(): |
| 135 | if file.name.endswith(".py"): |
| 136 | file.chmod(0755) |
| 137 | |
| 138 | (pyload / ".hgtags").remove() |
| 139 | (pyload / ".gitignore").remove() |
| 140 | #(pyload / "docs").rmtree() |
| 141 | |
| 142 | f = open(pyload / "__init__.py", "wb") |
| 143 | f.close() |
| 144 | |
| 145 | #options.setup.packages = find_packages() |
| 146 | #options.setup.package_data = find_package_data() |
| 147 | |
| 148 | |
| 149 | @task |
nothing calls this directly
no test coverage detected