Created
February 23, 2012 17:47
-
-
Save oleiade/1893994 to your computer and use it in GitHub Desktop.
requirements.txt package blacklisting git pre-commit hook
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 | |
# -*- coding: utf-8 -*- | |
import sys | |
import re | |
MANUAL_PACKAGES = dict.fromkeys([ | |
'leveldb', | |
]) | |
# Compile blacklisted packages regexp | |
for name in MANUAL_PACKAGES.keys(): | |
MANUAL_PACKAGES[name] = re.compile(r'^%s*' % name) | |
for line in open('requirements.txt', 'r'): | |
for r in MANUAL_PACKAGES.values(): | |
if r.match(line): | |
print "Error : Requirements.txt contains prohibited packages references" | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment