This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Use `locally` bootstrap code to get MinGW SDK for Windows | |
# operational from the local directory. | |
# This stuff is placed into public domain by | |
# anatoly techtonik <[email protected]> | |
# --- bootstrap .locally --- | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# This snippet is in public domain | |
# https://gist.github.com/techtonik/4066623/ | |
# Minified (Python 2.6+, 3+ compatible): | |
import io | |
from os.path import dirname, join | |
def get_version(relpath): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# https://gist.github.com/4368898 | |
# Public domain code by anatoly techtonik <[email protected]> | |
# AKA Linux `which` and Windows `where` | |
# For Python 3 you probably want | |
# https://docs.python.org/dev/library/shutil.html#shutil.which | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# tested with BitBucket | |
TRACKER = 'http://bitbucket.org/tarek/distribute' | |
# return contents of reStructureText file with linked issue references | |
def _linkified(rstfile): | |
revision = re.compile(r'\b(issue\s*#?\d+)\b', re.M | re.I) | |
rstext = open(rstfile).read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Build recursive hash of files in directory tree in hashdeep format. | |
Hashdeep format description: | |
http://md5deep.sourceforge.net/start-hashdeep.html | |
hashdeep.py differences from original hashdeep: | |
- if called without arguments, automatically starts to build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippet is placed into public domain by | |
# anatoly techtonik <[email protected]> | |
# http://stackoverflow.com/questions/8151300/ignore-case-in-glob-on-linux | |
import fnmatch | |
import os | |
import re | |
def findfiles(which, where='.'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Black magic to use Python logic for setting Makefile variables | |
# Real world example that is detecting AppEngine SDK with Python | |
# Helper code to detect SDK location | |
define DETECT_SDK | |
import os | |
locations = [ | |
"../google_appengine", | |
"/usr/local/google_appengine", | |
"../.locally/google_appengine", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# locally recipe that checks out Rietveld sources | |
# sources go into subdir, because hg is unable to | |
# checkout into dirty dir. no custom move logic | |
# is done also | |
# [ ] check rietveld checkout into given dir | |
# [ ] check dir/ | |
# [ ] check dir/.hg/ | |
# [ ] check dir/codereview/ | |
# [ ] clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# locally recipe that downloads patch and applies it | |
# --- bootstrap .locally --- | |
# | |
# this creates .locally/ subdirectory in the script's dir | |
# and sets a few global variables for convenience: | |
# | |
# ROOT - absolute path to bootstrap.py dir, ends with / | |
# LOOT - absolute path to the .locally/ subdir | |
# LIB - path to downloaded helper libs added to sys.path |