
import os
import sys
import shutil

from version import full_version
from optparse import OptionParser

import pkgutils


def main():
    usage = "usage: %prog [destination path]"
    parser = OptionParser(usage=usage)
    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.print_usage()
        sys.exit(1)

    dest = args[0]

    shutil.rmtree(dest, True)
    os.mkdir(dest)

    build_dir = pkgutils.package_builder_dir()
    binary_name = pkgutils.package_binary()
    binary = os.path.join(build_dir, binary_name)

    dest = os.path.join(dest, '%s-monitoring-agent-%s' % (pkgutils.pkg_dir(),
      full_version))
    if pkgutils.pkg_type() == 'windows':
        dest += '.msi'
    print("Moving %s to %s" % (binary, dest))
    shutil.move(binary, dest)

    if pkgutils.pkg_type() != 'windows':
        shutil.move(binary + ".sig", dest + ".sig")

if __name__ == "__main__":
    main()


import os
import sys
import shutil

from version import full_version
from optparse import OptionParser

import pkgutils


def main():
    usage = "usage: %prog [destination path]"
    parser = OptionParser(usage=usage)
    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.print_usage()
        sys.exit(1)

    dest = args[0]
    build_dir = pkgutils.package_builder_dir()
    binary_name = pkgutils.package_binary()
    binary = os.path.join(build_dir, binary_name)

    dest = os.path.join(dest, '%s-monitoring-agent-%s' % (pkgutils.pkg_dir(),
      full_version))
    if pkgutils.pkg_type() == 'windows':
        dest += '.msi'
    print("Moving %s to %s" % (binary, dest))
    shutil.move(binary, dest)

    if pkgutils.pkg_type() != 'windows':
        shutil.move(binary + ".sig", dest + ".sig")

if __name__ == "__main__":
    main()

Revert "remove the dest tree and recreate it"
Revert "remove the dest tree and recreate it"

This reverts commit becc4657acea505594836e62c49de2b4cb0160a9.

  
  import os
  import sys
  import shutil
  
  from version import full_version
  from optparse import OptionParser
  
  import pkgutils
  
  
  def main():
      usage = "usage: %prog [destination path]"
      parser = OptionParser(usage=usage)
      (options, args) = parser.parse_args()
  
      if len(args) != 1:
          parser.print_usage()
          sys.exit(1)
  
      dest = args[0]
- 
-     shutil.rmtree(dest, True)
-     os.mkdir(dest)
- 
      build_dir = pkgutils.package_builder_dir()
      binary_name = pkgutils.package_binary()
      binary = os.path.join(build_dir, binary_name)
  
      dest = os.path.join(dest, '%s-monitoring-agent-%s' % (pkgutils.pkg_dir(),
        full_version))
      if pkgutils.pkg_type() == 'windows':
          dest += '.msi'
      print("Moving %s to %s" % (binary, dest))
      shutil.move(binary, dest)
  
      if pkgutils.pkg_type() != 'windows':
          shutil.move(binary + ".sig", dest + ".sig")
  
  if __name__ == "__main__":
      main()
  
Revert "remove the dest tree and recreate it"
## Code Before:

import os
import sys
import shutil

from version import full_version
from optparse import OptionParser

import pkgutils


def main():
    usage = "usage: %prog [destination path]"
    parser = OptionParser(usage=usage)
    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.print_usage()
        sys.exit(1)

    dest = args[0]

    shutil.rmtree(dest, True)
    os.mkdir(dest)

    build_dir = pkgutils.package_builder_dir()
    binary_name = pkgutils.package_binary()
    binary = os.path.join(build_dir, binary_name)

    dest = os.path.join(dest, '%s-monitoring-agent-%s' % (pkgutils.pkg_dir(),
      full_version))
    if pkgutils.pkg_type() == 'windows':
        dest += '.msi'
    print("Moving %s to %s" % (binary, dest))
    shutil.move(binary, dest)

    if pkgutils.pkg_type() != 'windows':
        shutil.move(binary + ".sig", dest + ".sig")

if __name__ == "__main__":
    main()

## Instruction:
Revert "remove the dest tree and recreate it"
## Code After:

import os
import sys
import shutil

from version import full_version
from optparse import OptionParser

import pkgutils


def main():
    usage = "usage: %prog [destination path]"
    parser = OptionParser(usage=usage)
    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.print_usage()
        sys.exit(1)

    dest = args[0]
    build_dir = pkgutils.package_builder_dir()
    binary_name = pkgutils.package_binary()
    binary = os.path.join(build_dir, binary_name)

    dest = os.path.join(dest, '%s-monitoring-agent-%s' % (pkgutils.pkg_dir(),
      full_version))
    if pkgutils.pkg_type() == 'windows':
        dest += '.msi'
    print("Moving %s to %s" % (binary, dest))
    shutil.move(binary, dest)

    if pkgutils.pkg_type() != 'windows':
        shutil.move(binary + ".sig", dest + ".sig")

if __name__ == "__main__":
    main()
