build 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir="/var/tmp/dist/[% project %]"
  4. [% IF c("var/windows") -%]
  5. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  6. [% ELSE -%]
  7. [% c("var/set_PTDIR_DOCSDIR") -%]
  8. mkdir -p $PTDIR
  9. [% END -%]
  10. mkdir -p /var/tmp/build
  11. tar -C /var/tmp/build -xf $rootdir/Twisted-[% c('version') %].tar.bz2
  12. cd /var/tmp/build/Twisted-[% c('version') %]
  13. [% IF c("var/windows") -%]
  14. pydir="$distdir/python"
  15. export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
  16. export LD_PRELOAD=[% c("var/faketime_path") %]
  17. # twisted/internet/iocpreactor/iocpsupport/iocpsupport.c includes "python.h"
  18. # rather than "Python.h".
  19. ln -sf Python.h /var/tmp/dist/winpython/include/python.h
  20. # We need to set the "mingw32" compiler to avoid an error in build_ext, but
  21. # Twisted's "install" command calls build_ext unconditionally, whether the
  22. # extensions have been built already or not, so we can't just call build_ext
  23. # separately as with other packages. The "install" command doesn't recognize
  24. # the -c option, so we set the compiler in a configuration file.
  25. echo $'[build_ext]\ncompiler=mingw32' > setup.cfg
  26. mkdir -p $pydir/Lib/site-packages
  27. export PYTHONPATH="$(wine winepath -w $pydir)\\Lib\\site-packages"
  28. LD_PRELOAD= $PYTHON setup.py install --single-version-externally-managed --record /dev/null --prefix=$(wine winepath -w $pydir)
  29. [% ELSE -%]
  30. export PYTHON=python2
  31. $PYTHON setup.py build --build-lib build
  32. cp -a build/twisted $PTDIR/
  33. [% END -%]
  34. cd $distdir
  35. [% c('tar', {
  36. tar_src => [ '.' ],
  37. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  38. }) %]