You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.5 KiB

6 years ago
  1. """SCons.Tool.ipkg
  2. Tool-specific initialization for ipkg.
  3. There normally shouldn't be any need to import this module directly.
  4. It will usually be imported through the generic SCons.Tool.Tool()
  5. selection method.
  6. The ipkg tool calls the ipkg-build. Its only argument should be the
  7. packages fake_root.
  8. """
  9. #
  10. # Copyright (c) 2001 - 2017 The SCons Foundation
  11. #
  12. # Permission is hereby granted, free of charge, to any person obtaining
  13. # a copy of this software and associated documentation files (the
  14. # "Software"), to deal in the Software without restriction, including
  15. # without limitation the rights to use, copy, modify, merge, publish,
  16. # distribute, sublicense, and/or sell copies of the Software, and to
  17. # permit persons to whom the Software is furnished to do so, subject to
  18. # the following conditions:
  19. #
  20. # The above copyright notice and this permission notice shall be included
  21. # in all copies or substantial portions of the Software.
  22. #
  23. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  24. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  25. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. #
  31. __revision__ = "src/engine/SCons/Tool/ipkg.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  32. import os
  33. import SCons.Builder
  34. def generate(env):
  35. """Add Builders and construction variables for ipkg to an Environment."""
  36. try:
  37. bld = env['BUILDERS']['Ipkg']
  38. except KeyError:
  39. bld = SCons.Builder.Builder(action='$IPKGCOM',
  40. suffix='$IPKGSUFFIX',
  41. source_scanner=None,
  42. target_scanner=None)
  43. env['BUILDERS']['Ipkg'] = bld
  44. env['IPKG'] = 'ipkg-build'
  45. env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}'
  46. if env.WhereIs('id'):
  47. env['IPKGUSER'] = os.popen('id -un').read().strip()
  48. env['IPKGGROUP'] = os.popen('id -gn').read().strip()
  49. env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP')
  50. env['IPKGSUFFIX'] = '.ipk'
  51. def exists(env):
  52. """
  53. Can we find the tool
  54. """
  55. return env.Detect('ipkg-build')
  56. # Local Variables:
  57. # tab-width:4
  58. # indent-tabs-mode:nil
  59. # End:
  60. # vim: set expandtab tabstop=4 shiftwidth=4: