2012-05-02 03:25:35 -03:00
|
|
|
import sys, os, glob, shutil
|
2010-11-17 17:03:00 -02:00
|
|
|
from subprocess import check_call
|
2013-02-06 11:44:26 -02:00
|
|
|
from scrapy import version_info
|
2010-11-17 17:03:00 -02:00
|
|
|
|
|
|
|
def build(suffix):
|
2013-02-06 05:05:06 +00:00
|
|
|
for ifn in glob.glob("debian/scrapy.*"):
|
2010-11-17 17:03:00 -02:00
|
|
|
s = open(ifn).read()
|
|
|
|
s = s.replace('SUFFIX', suffix)
|
|
|
|
pre, suf = ifn.split('.', 1)
|
|
|
|
ofn = "%s-%s.%s" % (pre, suffix, suf)
|
|
|
|
with open(ofn, 'w') as of:
|
|
|
|
of.write(s)
|
|
|
|
|
|
|
|
for ifn in ['debian/control', 'debian/changelog']:
|
|
|
|
s = open(ifn).read()
|
|
|
|
s = s.replace('SUFFIX', suffix)
|
|
|
|
with open(ifn, 'w') as of:
|
|
|
|
of.write(s)
|
|
|
|
|
2011-06-18 03:31:47 -03:00
|
|
|
check_call('debchange -m -D unstable --force-distribution -v $(python setup.py --version)+$(date +%s) "Automatic build"', \
|
2012-01-02 13:28:24 -02:00
|
|
|
shell=True)
|
2010-11-17 17:03:00 -02:00
|
|
|
check_call('debuild -us -uc -b', shell=True)
|
|
|
|
|
|
|
|
def clean(suffix):
|
2013-02-06 05:05:06 +00:00
|
|
|
for f in glob.glob("debian/python-scrapy%s*" % suffix):
|
2012-05-02 03:25:35 -03:00
|
|
|
if os.path.isdir(f):
|
|
|
|
shutil.rmtree(f)
|
|
|
|
else:
|
|
|
|
os.remove(f)
|
2010-11-17 17:03:00 -02:00
|
|
|
|
|
|
|
def main():
|
|
|
|
cmd = sys.argv[1]
|
2013-02-06 11:44:26 -02:00
|
|
|
suffix = '%s.%s' % version_info[:2]
|
2010-11-17 17:03:00 -02:00
|
|
|
if cmd == 'build':
|
|
|
|
build(suffix)
|
|
|
|
elif cmd == 'clean':
|
|
|
|
clean(suffix)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|