<commit_before># Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'targets': [
    {
      'target_name': 'All',
      'type': 'none',
      'xcode_create_dependents_test_runner': 1,
      'dependencies': [
        '../app/app.gyp:*',
        '../base/base.gyp:*',
        '../chrome/browser/sync/tools/sync_tools.gyp:*',
        '../chrome/chrome.gyp:*',
        '../gfx/gfx.gyp:*',
        '../gpu/gpu.gyp:*',
        '../gpu/demos/demos.gyp:*',
        '../ipc/ipc.gyp:*',
        '../jingle/jingle.gyp:*',
        '../media/media.gyp:*',
        '../net/net.gyp:*',
        '../net/third_party/nss/ssl.gyp:*',
        '../printing/printing.gyp:*',
        '../sdch/sdch.gyp:*',
        '../skia/skia.gyp:*',
        '../testing/gmock.gyp:*',
        '../testing/gtest.gyp:*',
        '../third_party/bzip2/bzip2.gyp:*',
        '../third_party/cacheinvalidation/cacheinvalidation.gyp:*',
        '../third_party/cld/cld.gyp:*',
        '../third_party/codesighs/codesighs.gyp:*',
        '../third_party/ffmpeg/ffmpeg.gyp:*',
        '../third_party/icu/icu.gyp:*',
        '../third_party/libjpeg/libjpeg.gyp:*',
        '../third_party/libpng/libpng.gyp:*',
        '../third_party/libxml/libxml.gyp:*',
        '../third_party/libxslt/libxslt.gyp:*',
        '../third_party/lzma_sdk/lzma_sdk.gyp:*',
        '../third_party/mesa/mesa.gyp:*',
        '../third_party/modp_b64/modp_b64.gyp:*',
        '../third_party/npapi/npapi.gyp:*',
        '../third_party/ppapi/ppapi.gyp:*',
        '../third_party/ots/ots.gyp:*',
        '../third_party/sqlite/sqlite.gyp:*',
        '../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
        '../third_party/zlib/zlib.gyp:*',
        '../webkit/support/webkit_support.gyp:*',
        '../webkit/webkit.gyp:*',
        'util/build_util.gyp:*',
        'temp_gyp/googleurl.gyp:*',
      ],
      'conditions': [
        ['javascript_engine=="v8"', {
          'dependencies': [
            '../v8/tools/gyp/v8.gyp:*',
          ],
        }],
        ['OS=="mac" or OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
          'dependencies': [
            '../third_party/yasm/yasm.gyp:*#host',
           ],
        }],
        ['OS=="mac" or OS=="win"', {
          'dependencies': [
            '../third_party/nss/nss.gyp:*',
           ],
        }],
        ['OS=="mac"', {
          'dependencies': [
            '../third_party/ocmock/ocmock.gyp:*',
          ],
        }],
        ['OS=="linux"', {
          'dependencies': [
            '../breakpad/breakpad.gyp:*',
            '../courgette/courgette.gyp:*',
            '../sandbox/sandbox.gyp:*',
          ],
          'conditions': [
            ['branding=="Chrome"', {
              'dependencies': [
                '../chrome/chrome.gyp:linux_packages_<(channel)',
              ],
            }],
          ],
        }],
        ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
          'dependencies': [
            '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
            '../tools/xdisplaycheck/xdisplaycheck.gyp:*',
          ],
        }],
        ['OS=="win"', {
          'conditions': [
            ['win_use_allocator_shim==1', {
              'dependencies': [
                '../base/allocator/allocator.gyp:*',
              ],
            }],
          ],
          'dependencies': [
            '../breakpad/breakpad.gyp:*',
            '../chrome/app/locales/locales.gyp:*',
            '../chrome_frame/chrome_frame.gyp:*',
            '../courgette/courgette.gyp:*',
            '../gears/gears.gyp:*',
            '../rlz/rlz.gyp:*',
            '../sandbox/sandbox.gyp:*',
            '../third_party/bsdiff/bsdiff.gyp:*',
            '../third_party/bspatch/bspatch.gyp:*',
            '../third_party/gles2_book/gles2_book.gyp:*',
            '../tools/memory_watcher/memory_watcher.gyp:*',
          ],
        }, {
          'dependencies': [
            '../third_party/libevent/libevent.gyp:*',
          ],
        }],
        ['toolkit_views==1', {
          'dependencies': [
            '../views/views.gyp:*',
          ],
        }],
        ['chromeos==1', {
          'dependencies': [
            '../chrome/browser/chromeos/input_method/candidate_window.gyp:*',
          ],
        }],
        ['remoting==1', {
          'dependencies': [
            '../remoting/remoting.gyp:*',
          ],
        }],
      ],
    },
  ],
  'conditions': [
    ['OS=="mac"', {
      'targets': [
        {
          # Target to build everything plus the dmg.  We don't put the dmg
          # in the All target because developers really don't need it.
          'target_name': 'all_and_dmg',
          'type': 'none',
          'dependencies': [
            'All',
            '../chrome/chrome.gyp:build_app_dmg',
          ],
        },
        # These targets are here so the build bots can use them to build
        # subsets of a full tree for faster cycle times.
        {
          'target_name': 'chromium_builder_dbg',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
        {
          'target_name': 'chromium_builder_rel',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:plugin_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
        {
          'target_name': 'chromium_builder_dbg_tsan_mac',
          'type': 'none',
          'dependencies': [
            '../base/base.gyp:base_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../net/net.gyp:net_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
          ],
        },
      ],  # targets
    }], # OS="mac"
    ['OS=="win"', {
      'targets': [
        # These targets are here so the build bots can use them to build
        # subsets of a full tree for faster cycle times.
        {
          'target_name': 'chromium_builder',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:installer_util_unittests',
            '../chrome/chrome.gyp:interactive_ui_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:mini_installer_test',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:plugin_tests',
            '../chrome/chrome.gyp:selenium_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            # mini_installer_tests depends on mini_installer. This should be
            # defined in installer.gyp.
            '../chrome/installer/mini_installer.gyp:mini_installer',
            '../courgette/courgette.gyp:courgette_unittests',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            '../webkit/support/webkit_support.gyp:npapi_layout_test_plugin',
            # TODO(nsylvain) ui_tests.exe depends on test_shell_common.
            # This should:
            # 1) not be the case. OR.
            # 2) be expressed in the ui tests dependencies.
            '../webkit/webkit.gyp:test_shell_common',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
            '../chrome_frame/chrome_frame.gyp:npchrome_frame',
            '../third_party/angle/src/build_angle.gyp:*',
          ],
        },
        {
          'target_name': 'chromium_builder_dbg_tsan_win',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            # TODO(bradnelson): app_unittests should depend on locales.
            # However, we can't add dependencies on chrome/ to app/
            # See http://crbug.com/43603
            '../base/base.gyp:base_unittests',
            '../chrome/app/locales/locales.gyp:*',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../net/net.gyp:net_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
      ],  # targets
    }], # OS="win"
    ['chromeos==1', {
      'targets': [
        {
          'target_name': 'chromeos_builder',
          'type': 'none',
          'sources': [
            # TODO(bradnelson): This is here to work around gyp issue 137.
            #     Remove this sources list when that issue has been fixed.
            'all.gyp',
          ],
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../base/base.gyp:base_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:chrome',
            '../chrome/chrome.gyp:interactive_ui_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            '../gfx/gfx.gyp:gfx_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:ffmpeg_tests',
            '../media/media.gyp:media_unittests',
            '../media/media.gyp:omx_test',
            '../net/net.gyp:net_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../chrome/browser/chromeos/input_method/candidate_window.gyp:candidate_window',
          ],
        },
      ],  # targets
    }], # "chromeos==1"
  ], # conditions
}

# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
<commit_msg>Build the nacl_sandbox tests on the bot. We will soon run them.<commit_after># Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'targets': [
    {
      'target_name': 'All',
      'type': 'none',
      'xcode_create_dependents_test_runner': 1,
      'dependencies': [
        '../app/app.gyp:*',
        '../base/base.gyp:*',
        '../chrome/browser/sync/tools/sync_tools.gyp:*',
        '../chrome/chrome.gyp:*',
        '../gfx/gfx.gyp:*',
        '../gpu/gpu.gyp:*',
        '../gpu/demos/demos.gyp:*',
        '../ipc/ipc.gyp:*',
        '../jingle/jingle.gyp:*',
        '../media/media.gyp:*',
        '../net/net.gyp:*',
        '../net/third_party/nss/ssl.gyp:*',
        '../printing/printing.gyp:*',
        '../sdch/sdch.gyp:*',
        '../skia/skia.gyp:*',
        '../testing/gmock.gyp:*',
        '../testing/gtest.gyp:*',
        '../third_party/bzip2/bzip2.gyp:*',
        '../third_party/cacheinvalidation/cacheinvalidation.gyp:*',
        '../third_party/cld/cld.gyp:*',
        '../third_party/codesighs/codesighs.gyp:*',
        '../third_party/ffmpeg/ffmpeg.gyp:*',
        '../third_party/icu/icu.gyp:*',
        '../third_party/libjpeg/libjpeg.gyp:*',
        '../third_party/libpng/libpng.gyp:*',
        '../third_party/libxml/libxml.gyp:*',
        '../third_party/libxslt/libxslt.gyp:*',
        '../third_party/lzma_sdk/lzma_sdk.gyp:*',
        '../third_party/mesa/mesa.gyp:*',
        '../third_party/modp_b64/modp_b64.gyp:*',
        '../third_party/npapi/npapi.gyp:*',
        '../third_party/ppapi/ppapi.gyp:*',
        '../third_party/ots/ots.gyp:*',
        '../third_party/sqlite/sqlite.gyp:*',
        '../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
        '../third_party/zlib/zlib.gyp:*',
        '../webkit/support/webkit_support.gyp:*',
        '../webkit/webkit.gyp:*',
        'util/build_util.gyp:*',
        'temp_gyp/googleurl.gyp:*',
      ],
      'conditions': [
        ['javascript_engine=="v8"', {
          'dependencies': [
            '../v8/tools/gyp/v8.gyp:*',
          ],
        }],
        ['OS=="mac" or OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
          'dependencies': [
            '../third_party/yasm/yasm.gyp:*#host',
           ],
        }],
        ['OS=="mac" or OS=="win"', {
          'dependencies': [
            '../third_party/nss/nss.gyp:*',
           ],
        }],
        ['OS=="mac"', {
          'dependencies': [
            '../third_party/ocmock/ocmock.gyp:*',
          ],
        }],
        ['OS=="linux"', {
          'dependencies': [
            '../breakpad/breakpad.gyp:*',
            '../courgette/courgette.gyp:*',
            '../sandbox/sandbox.gyp:*',
          ],
          'conditions': [
            ['branding=="Chrome"', {
              'dependencies': [
                '../chrome/chrome.gyp:linux_packages_<(channel)',
              ],
            }],
          ],
        }],
        ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
          'dependencies': [
            '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
            '../tools/xdisplaycheck/xdisplaycheck.gyp:*',
          ],
        }],
        ['OS=="win"', {
          'conditions': [
            ['win_use_allocator_shim==1', {
              'dependencies': [
                '../base/allocator/allocator.gyp:*',
              ],
            }],
          ],
          'dependencies': [
            '../breakpad/breakpad.gyp:*',
            '../chrome/app/locales/locales.gyp:*',
            '../chrome_frame/chrome_frame.gyp:*',
            '../courgette/courgette.gyp:*',
            '../gears/gears.gyp:*',
            '../rlz/rlz.gyp:*',
            '../sandbox/sandbox.gyp:*',
            '../third_party/bsdiff/bsdiff.gyp:*',
            '../third_party/bspatch/bspatch.gyp:*',
            '../third_party/gles2_book/gles2_book.gyp:*',
            '../tools/memory_watcher/memory_watcher.gyp:*',
          ],
        }, {
          'dependencies': [
            '../third_party/libevent/libevent.gyp:*',
          ],
        }],
        ['toolkit_views==1', {
          'dependencies': [
            '../views/views.gyp:*',
          ],
        }],
        ['chromeos==1', {
          'dependencies': [
            '../chrome/browser/chromeos/input_method/candidate_window.gyp:*',
          ],
        }],
        ['remoting==1', {
          'dependencies': [
            '../remoting/remoting.gyp:*',
          ],
        }],
      ],
    },
  ],
  'conditions': [
    ['OS=="mac"', {
      'targets': [
        {
          # Target to build everything plus the dmg.  We don't put the dmg
          # in the All target because developers really don't need it.
          'target_name': 'all_and_dmg',
          'type': 'none',
          'dependencies': [
            'All',
            '../chrome/chrome.gyp:build_app_dmg',
          ],
        },
        # These targets are here so the build bots can use them to build
        # subsets of a full tree for faster cycle times.
        {
          'target_name': 'chromium_builder_dbg',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:nacl_sandbox_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
        {
          'target_name': 'chromium_builder_rel',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:nacl_sandbox_tests',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:plugin_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
        {
          'target_name': 'chromium_builder_dbg_tsan_mac',
          'type': 'none',
          'dependencies': [
            '../base/base.gyp:base_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../net/net.gyp:net_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
          ],
        },
      ],  # targets
    }], # OS="mac"
    ['OS=="win"', {
      'targets': [
        # These targets are here so the build bots can use them to build
        # subsets of a full tree for faster cycle times.
        {
          'target_name': 'chromium_builder',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:installer_util_unittests',
            '../chrome/chrome.gyp:interactive_ui_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:mini_installer_test',
            '../chrome/chrome.gyp:nacl_ui_tests',
            '../chrome/chrome.gyp:nacl_sandbox_tests',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:plugin_tests',
            '../chrome/chrome.gyp:selenium_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            # mini_installer_tests depends on mini_installer. This should be
            # defined in installer.gyp.
            '../chrome/installer/mini_installer.gyp:mini_installer',
            '../courgette/courgette.gyp:courgette_unittests',
            '../gfx/gfx.gyp:gfx_unittests',
            '../gpu/gpu.gyp:gpu_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            '../webkit/support/webkit_support.gyp:npapi_layout_test_plugin',
            # TODO(nsylvain) ui_tests.exe depends on test_shell_common.
            # This should:
            # 1) not be the case. OR.
            # 2) be expressed in the ui tests dependencies.
            '../webkit/webkit.gyp:test_shell_common',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_tests',
            '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
            '../chrome_frame/chrome_frame.gyp:npchrome_frame',
            '../third_party/angle/src/build_angle.gyp:*',
          ],
        },
        {
          'target_name': 'chromium_builder_dbg_tsan_win',
          'type': 'none',
          'dependencies': [
            '../app/app.gyp:app_unittests',
            # TODO(bradnelson): app_unittests should depend on locales.
            # However, we can't add dependencies on chrome/ to app/
            # See http://crbug.com/43603
            '../base/base.gyp:base_unittests',
            '../chrome/app/locales/locales.gyp:*',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:media_unittests',
            '../net/net.gyp:net_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
          ],
        },
      ],  # targets
    }], # OS="win"
    ['chromeos==1', {
      'targets': [
        {
          'target_name': 'chromeos_builder',
          'type': 'none',
          'sources': [
            # TODO(bradnelson): This is here to work around gyp issue 137.
            #     Remove this sources list when that issue has been fixed.
            'all.gyp',
          ],
          'dependencies': [
            '../app/app.gyp:app_unittests',
            '../base/base.gyp:base_unittests',
            '../chrome/chrome.gyp:browser_tests',
            '../chrome/chrome.gyp:chrome',
            '../chrome/chrome.gyp:interactive_ui_tests',
            '../chrome/chrome.gyp:memory_test',
            '../chrome/chrome.gyp:page_cycler_tests',
            '../chrome/chrome.gyp:startup_tests',
            '../chrome/chrome.gyp:sync_unit_tests',
            '../chrome/chrome.gyp:tab_switching_test',
            '../chrome/chrome.gyp:ui_tests',
            '../chrome/chrome.gyp:unit_tests',
            '../chrome/chrome.gyp:url_fetch_test',
            '../gfx/gfx.gyp:gfx_unittests',
            '../ipc/ipc.gyp:ipc_tests',
            '../jingle/jingle.gyp:notifier_unit_tests',
            '../media/media.gyp:ffmpeg_tests',
            '../media/media.gyp:media_unittests',
            '../media/media.gyp:omx_test',
            '../net/net.gyp:net_unittests',
            '../printing/printing.gyp:printing_unittests',
            '../remoting/remoting.gyp:remoting_unittests',
            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
            'temp_gyp/googleurl.gyp:googleurl_unittests',
            '../chrome/browser/chromeos/input_method/candidate_window.gyp:candidate_window',
          ],
        },
      ],  # targets
    }], # "chromeos==1"
  ], # conditions
}

# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
<|endoftext|>


<commit_before># Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Kevin Lim

import m5
from m5 import makeList
from m5.objects import *
from Benchmarks import *

class CowIdeDisk(IdeDisk):
    image = CowDiskImage(child=RawDiskImage(read_only=True),
                         read_only=False)

    def childImage(self, ci):
        self.image.child.image_file = ci

def makeLinuxAlphaSystem(mem_mode, mdesc = None):
    class BaseTsunami(Tsunami):
        ethernet = NSGigE(configdata=NSGigEPciData(),
                          pci_bus=0, pci_dev=1, pci_func=0)
        etherint = NSGigEInt(device=Parent.ethernet)
        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
                            pci_func=0, pci_dev=0, pci_bus=0)

    self = LinuxAlphaSystem()
    if not mdesc:
        # generic system
        mdesc = SysConfig()
    self.readfile = mdesc.script()
    self.iobus = Bus(bus_id=0)
    self.membus = Bus(bus_id=1)
    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
    self.bridge.side_a = self.iobus.port
    self.bridge.side_b = self.membus.port
    self.physmem.port = self.membus.port
    self.disk0 = CowIdeDisk(driveID='master')
    self.disk2 = CowIdeDisk(driveID='master')
    self.disk0.childImage(mdesc.disk())
    self.disk2.childImage(disk('linux-bigswap2.img'))
    self.tsunami = BaseTsunami()
    self.tsunami.attachIO(self.iobus)
    self.tsunami.ide.pio = self.iobus.port
    self.tsunami.ethernet.pio = self.iobus.port
    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
                                               read_only = True))
    self.intrctrl = IntrControl()
    self.mem_mode = mem_mode
    self.sim_console = SimConsole()
    self.kernel = binary('vmlinux')
    self.pal = binary('ts_osfpal')
    self.console = binary('console')
    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'

    return self

def makeSparcSystem(mem_mode, mdesc = None):
    class CowMmDisk(MmDisk):
        image = CowDiskImage(child=RawDiskImage(read_only=True),
                             read_only=False)

        def childImage(self, ci):
            self.image.child.image_file = ci

    self = SparcSystem()
    if not mdesc:
        # generic system
        mdesc = SysConfig()
    self.readfile = mdesc.script()
    self.iobus = Bus(bus_id=0)
    self.membus = Bus(bus_id=1)
    self.bridge = Bridge(fix_partial_write_b=True, delay='50ns', nack_delay='4ns')
    self.t1000 = T1000()
    self.t1000.attachOnChipIO(self.membus)
    self.t1000.attachIO(self.iobus)
    self.physmem = PhysicalMemory(range = AddrRange(Addr('1MB'), size = '64MB'), zero = True)
    self.physmem2 = PhysicalMemory(range = AddrRange(Addr('2GB'), size ='256MB'), zero = True)
    self.bridge.side_a = self.iobus.port
    self.bridge.side_b = self.membus.port
    self.physmem.port = self.membus.port
    self.physmem2.port = self.membus.port
    self.rom.port = self.membus.port
    self.nvram.port = self.membus.port
    self.hypervisor_desc.port = self.membus.port
    self.partition_desc.port = self.membus.port
    self.intrctrl = IntrControl()
    self.disk0 = CowMmDisk()
    self.disk0.childImage(disk('disk.s10hw2'))
    self.disk0.pio = self.iobus.port
    self.reset_bin = binary('reset_new.bin')
    self.hypervisor_bin = binary('q_new.bin')
    self.openboot_bin = binary('openboot_new.bin')
    self.nvram_bin = binary('nvram1')
    self.hypervisor_desc_bin = binary('1up-hv.bin')
    self.partition_desc_bin = binary('1up-md.bin')

    return self

def makeDualRoot(testSystem, driveSystem, dumpfile):
    self = Root()
    self.testsys = testSystem
    self.drivesys = driveSystem
    self.etherlink = EtherLink(int1 = Parent.testsys.tsunami.etherint[0],
                               int2 = Parent.drivesys.tsunami.etherint[0])
    if dumpfile:
        self.etherdump = EtherDump(file=dumpfile)
        self.etherlink.dump = Parent.etherdump

    return self
<commit_msg>Regression: fix configuration for SPARC_FS<commit_after># Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Kevin Lim

import m5
from m5 import makeList
from m5.objects import *
from Benchmarks import *

class CowIdeDisk(IdeDisk):
    image = CowDiskImage(child=RawDiskImage(read_only=True),
                         read_only=False)

    def childImage(self, ci):
        self.image.child.image_file = ci

def makeLinuxAlphaSystem(mem_mode, mdesc = None):
    class BaseTsunami(Tsunami):
        ethernet = NSGigE(configdata=NSGigEPciData(),
                          pci_bus=0, pci_dev=1, pci_func=0)
        etherint = NSGigEInt(device=Parent.ethernet)
        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
                            pci_func=0, pci_dev=0, pci_bus=0)

    self = LinuxAlphaSystem()
    if not mdesc:
        # generic system
        mdesc = SysConfig()
    self.readfile = mdesc.script()
    self.iobus = Bus(bus_id=0)
    self.membus = Bus(bus_id=1)
    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
    self.bridge.side_a = self.iobus.port
    self.bridge.side_b = self.membus.port
    self.physmem.port = self.membus.port
    self.disk0 = CowIdeDisk(driveID='master')
    self.disk2 = CowIdeDisk(driveID='master')
    self.disk0.childImage(mdesc.disk())
    self.disk2.childImage(disk('linux-bigswap2.img'))
    self.tsunami = BaseTsunami()
    self.tsunami.attachIO(self.iobus)
    self.tsunami.ide.pio = self.iobus.port
    self.tsunami.ethernet.pio = self.iobus.port
    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
                                               read_only = True))
    self.intrctrl = IntrControl()
    self.mem_mode = mem_mode
    self.sim_console = SimConsole()
    self.kernel = binary('vmlinux')
    self.pal = binary('ts_osfpal')
    self.console = binary('console')
    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'

    return self

def makeSparcSystem(mem_mode, mdesc = None):
    class CowMmDisk(MmDisk):
        image = CowDiskImage(child=RawDiskImage(read_only=True),
                             read_only=False)

        def childImage(self, ci):
            self.image.child.image_file = ci

    self = SparcSystem()
    if not mdesc:
        # generic system
        mdesc = SysConfig()
    self.readfile = mdesc.script()
    self.iobus = Bus(bus_id=0)
    self.membus = Bus(bus_id=1)
    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
    self.t1000 = T1000()
    self.t1000.attachOnChipIO(self.membus)
    self.t1000.attachIO(self.iobus)
    self.physmem = PhysicalMemory(range = AddrRange(Addr('1MB'), size = '64MB'), zero = True)
    self.physmem2 = PhysicalMemory(range = AddrRange(Addr('2GB'), size ='256MB'), zero = True)
    self.bridge.side_a = self.iobus.port
    self.bridge.side_b = self.membus.port
    self.physmem.port = self.membus.port
    self.physmem2.port = self.membus.port
    self.rom.port = self.membus.port
    self.nvram.port = self.membus.port
    self.hypervisor_desc.port = self.membus.port
    self.partition_desc.port = self.membus.port
    self.intrctrl = IntrControl()
    self.disk0 = CowMmDisk()
    self.disk0.childImage(disk('disk.s10hw2'))
    self.disk0.pio = self.iobus.port
    self.reset_bin = binary('reset_new.bin')
    self.hypervisor_bin = binary('q_new.bin')
    self.openboot_bin = binary('openboot_new.bin')
    self.nvram_bin = binary('nvram1')
    self.hypervisor_desc_bin = binary('1up-hv.bin')
    self.partition_desc_bin = binary('1up-md.bin')

    return self

def makeDualRoot(testSystem, driveSystem, dumpfile):
    self = Root()
    self.testsys = testSystem
    self.drivesys = driveSystem
    self.etherlink = EtherLink(int1 = Parent.testsys.tsunami.etherint[0],
                               int2 = Parent.drivesys.tsunami.etherint[0])
    if dumpfile:
        self.etherdump = EtherDump(file=dumpfile)
        self.etherlink.dump = Parent.etherdump

    return self
<|endoftext|>


<commit_before>#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import re

import pyauto_functional  # Must be imported before pyauto
import pyauto
import test_utils

class InfobarTest(pyauto.PyUITest):
  """TestCase for Infobars."""

  def Debug(self):
    """Test method for experimentation.

    This method will not run automatically.
    To run:
      python chrome/test/functional/infobars.py infobars.InfobarTest.Debug
    """
    import pprint
    pp = pprint.PrettyPrinter(indent=2)
    while True:
      raw_input('Hit <enter> to dump info.. ')
      info = self.GetBrowserInfo()
      for window in info['windows']:
        for tab in window['tabs']:
          print 'Window', window['index'], 'tab', tab['index']
          pp.pprint(tab['infobars'])

  def setUp(self):
    pyauto.PyUITest.setUp(self)
    self._flash_plugin_type = 'Plug-in'
    if (self.IsChromeOS() and
        self.GetBrowserInfo()['properties']['branding'] == 'Google Chrome'):
      self._flash_plugin_type = 'Pepper Plugin'

  def _GetTabInfo(self, windex=0, tab_index=0):
    """Helper to return info for the given tab in the given window.

    Defaults to first tab in first window.
    """
    return self.GetBrowserInfo()['windows'][windex]['tabs'][tab_index]

  def testPluginCrashInfobar(self):
    """Verify the "plugin crashed" infobar."""
    flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
    # Trigger flash plugin
    self.NavigateToURL(flash_url)
    child_processes = self.GetBrowserInfo()['child_processes']
    flash = [x for x in child_processes if
             x['type'] == self._flash_plugin_type and
             x['name'] == 'Shockwave Flash'][0]
    self.assertTrue(flash)
    logging.info('Killing flash plugin. pid %d' % flash['pid'])
    self.Kill(flash['pid'])
    self.assertTrue(self.WaitForInfobarCount(1))
    crash_infobar = self._GetTabInfo()['infobars']
    self.assertTrue(crash_infobar)
    self.assertEqual(1, len(crash_infobar))
    self.assertTrue(re.match('The following plug-in has crashed:',
                             crash_infobar[0]['text']))
    self.assertEqual('confirm_infobar', crash_infobar[0]['type'])
    # Dismiss the infobar
    self.PerformActionOnInfobar('dismiss', infobar_index=0)
    self.assertFalse(self._GetTabInfo()['infobars'])

  def _VerifyGeolocationInfobar(self, match_text, windex, tab_index):
    """Verify geolocation infobar and match given text.

    Assumes that geolocation infobar is showing up in the given tab in the
    given window.
    """
    tab_info = self._GetTabInfo(windex, tab_index)
    geolocation_infobar = tab_info['infobars']
    self.assertTrue(geolocation_infobar)
    self.assertEqual(1, len(geolocation_infobar))
    self.assertEqual(match_text, geolocation_infobar[0]['text'])
    self.assertEqual('Learn more', geolocation_infobar[0]['link_text'])
    self.assertEqual(2, len(geolocation_infobar[0]['buttons']))
    self.assertEqual('Allow', geolocation_infobar[0]['buttons'][0])
    self.assertEqual('Deny', geolocation_infobar[0]['buttons'][1])

  def testGeolocationInfobar(self):
    """Verify geoLocation infobar."""
    url = self.GetFileURLForDataPath(  # triggers geolocation
        'geolocation', 'geolocation_on_load.html')
    match_text='file:/// wants to track your physical location'
    self.NavigateToURL(url)
    self.assertTrue(self.WaitForInfobarCount(1))
    self._VerifyGeolocationInfobar(windex=0, tab_index=0, match_text=match_text)
    # Accept, and verify that the infobar went away
    self.PerformActionOnInfobar('accept', infobar_index=0)
    self.assertFalse(self._GetTabInfo()['infobars'])

  def testGeolocationInfobarInMultipleTabsAndWindows(self):
    """Verify GeoLocation inforbar in multiple tabs."""
    url = self.GetFileURLForDataPath(  # triggers geolocation
        'geolocation', 'geolocation_on_load.html')
    match_text='file:/// wants to track your physical location'
    for tab_index in range(1, 2):
      self.AppendTab(pyauto.GURL(url))
      self.assertTrue(
          self.WaitForInfobarCount(1, windex=0, tab_index=tab_index))
      self._VerifyGeolocationInfobar(windex=0, tab_index=tab_index,
                                     match_text=match_text)
    # Try in a new window
    self.OpenNewBrowserWindow(True)
    self.NavigateToURL(url, 1, 0)
    self.assertTrue(self.WaitForInfobarCount(1, windex=1, tab_index=0))
    self._VerifyGeolocationInfobar(windex=1, tab_index=0, match_text=match_text)
    # Incognito window
    self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
    self.NavigateToURL(url, 2, 0)
    self.assertTrue(self.WaitForInfobarCount(1, windex=2, tab_index=0))
    self._VerifyGeolocationInfobar(windex=2, tab_index=0, match_text=match_text)

  def testMultipleDownloadsInfobar(self):
    """Verify the mutiple downloads infobar."""
    zip_file = 'a_zip_file.zip'
    html_file = 'download-a_zip_file.html'
    assert pyauto.PyUITest.IsEnUS()
    file_url = self.GetFileURLForDataPath('downloads', html_file)
    match_text = 'This site is attempting to download multiple files. ' \
                 'Do you want to allow this?'
    self.NavigateToURL('chrome://downloads')  # trigger download manager
    test_utils.RemoveDownloadedTestFile(self, zip_file)
    self.DownloadAndWaitForStart(file_url)
    # trigger page reload, which triggers the download infobar
    self.GetBrowserWindow(0).GetTab(0).Reload()
    self.assertTrue(self.WaitForInfobarCount(1))
    tab_info = self._GetTabInfo(0, 0)
    infobars = tab_info['infobars']
    self.assertTrue(infobars, 'Expected the multiple downloads infobar')
    self.assertEqual(1, len(infobars))
    self.assertEqual(match_text, infobars[0]['text'])
    self.assertEqual(2, len(infobars[0]['buttons']))
    self.assertEqual('Allow', infobars[0]['buttons'][0])
    self.assertEqual('Deny', infobars[0]['buttons'][1])
    self.WaitForAllDownloadsToComplete()
    test_utils.RemoveDownloadedTestFile(self, zip_file)

  def testPluginCrashForMultiTabs(self):
    """Verify plugin crash infobar shows up only on the tabs using plugin."""
    if self.IsMac():
      # On Mac 10.5, flash files loaded too quickly after firing browser ends
      # up getting downloaded, which seems to indicate that the plugin hasn't
      # been registered yet.
      # Hack to register Flash plugin on Mac 10.5.  crbug.com/94123
      self.GetPluginsInfo()
    non_flash_url = self.GetFileURLForDataPath('english_page.html')
    flash_url = self.GetFileURLForDataPath('plugin', 'FlashSpin.swf')
    # False = Non flash url, True = Flash url
    # We have set of these values to compare a flash page and a non-flash page
    urls_type = [False, True, False, True, False]
    for count in range(2):
      self.AppendTab(pyauto.GURL(flash_url))
      self.AppendTab(pyauto.GURL(non_flash_url))
    # Killing flash process
    child_processes = self.GetBrowserInfo()['child_processes']
    flash = [x for x in child_processes if
             x['type'] == self._flash_plugin_type and
             x['name'] == 'Shockwave Flash'][0]
    self.assertTrue(flash)
    self.Kill(flash['pid'])
    # Crash plugin infobar should show up in the second tab of this window
    # so passing window and tab argument in the wait for an infobar.
    self.assertTrue(self.WaitForInfobarCount(1, windex=0, tab_index=1))
    for i in range(len(urls_type)):
      # Verify that if page doesn't have flash plugin,
      # it should not have infobar popped-up
      self.ActivateTab(i)
      if not urls_type[i]:
        info = self.GetBrowserInfo()
        self.assertFalse(
            info['windows'][0]['tabs'][i]['infobars'],
            msg='Did not expect crash infobar in tab at index %d' % i)
      elif urls_type[i]:
        self.assertTrue(
            self.WaitForInfobarCount(1, windex=0, tab_index=i),
            msg='Expected crash infobar in tab at index %d' % i)
        infobar = self.GetBrowserInfo()['windows'][0]['tabs'][i]['infobars']
        self.assertEqual(infobar[0]['type'], 'confirm_infobar')
        self.assertEqual(len(infobar), 1)

if __name__ == '__main__':
  pyauto_functional.Main()
<commit_msg>Add trailing periods to some expected text<commit_after>#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import re

import pyauto_functional  # Must be imported before pyauto
import pyauto
import test_utils

class InfobarTest(pyauto.PyUITest):
  """TestCase for Infobars."""

  def Debug(self):
    """Test method for experimentation.

    This method will not run automatically.
    To run:
      python chrome/test/functional/infobars.py infobars.InfobarTest.Debug
    """
    import pprint
    pp = pprint.PrettyPrinter(indent=2)
    while True:
      raw_input('Hit <enter> to dump info.. ')
      info = self.GetBrowserInfo()
      for window in info['windows']:
        for tab in window['tabs']:
          print 'Window', window['index'], 'tab', tab['index']
          pp.pprint(tab['infobars'])

  def setUp(self):
    pyauto.PyUITest.setUp(self)
    self._flash_plugin_type = 'Plug-in'
    if (self.IsChromeOS() and
        self.GetBrowserInfo()['properties']['branding'] == 'Google Chrome'):
      self._flash_plugin_type = 'Pepper Plugin'

  def _GetTabInfo(self, windex=0, tab_index=0):
    """Helper to return info for the given tab in the given window.

    Defaults to first tab in first window.
    """
    return self.GetBrowserInfo()['windows'][windex]['tabs'][tab_index]

  def testPluginCrashInfobar(self):
    """Verify the "plugin crashed" infobar."""
    flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
    # Trigger flash plugin
    self.NavigateToURL(flash_url)
    child_processes = self.GetBrowserInfo()['child_processes']
    flash = [x for x in child_processes if
             x['type'] == self._flash_plugin_type and
             x['name'] == 'Shockwave Flash'][0]
    self.assertTrue(flash)
    logging.info('Killing flash plugin. pid %d' % flash['pid'])
    self.Kill(flash['pid'])
    self.assertTrue(self.WaitForInfobarCount(1))
    crash_infobar = self._GetTabInfo()['infobars']
    self.assertTrue(crash_infobar)
    self.assertEqual(1, len(crash_infobar))
    self.assertTrue(re.match('The following plug-in has crashed:',
                             crash_infobar[0]['text']))
    self.assertEqual('confirm_infobar', crash_infobar[0]['type'])
    # Dismiss the infobar
    self.PerformActionOnInfobar('dismiss', infobar_index=0)
    self.assertFalse(self._GetTabInfo()['infobars'])

  def _VerifyGeolocationInfobar(self, match_text, windex, tab_index):
    """Verify geolocation infobar and match given text.

    Assumes that geolocation infobar is showing up in the given tab in the
    given window.
    """
    tab_info = self._GetTabInfo(windex, tab_index)
    geolocation_infobar = tab_info['infobars']
    self.assertTrue(geolocation_infobar)
    self.assertEqual(1, len(geolocation_infobar))
    self.assertEqual(match_text, geolocation_infobar[0]['text'])
    self.assertEqual('Learn more', geolocation_infobar[0]['link_text'])
    self.assertEqual(2, len(geolocation_infobar[0]['buttons']))
    self.assertEqual('Allow', geolocation_infobar[0]['buttons'][0])
    self.assertEqual('Deny', geolocation_infobar[0]['buttons'][1])

  def testGeolocationInfobar(self):
    """Verify geoLocation infobar."""
    url = self.GetFileURLForDataPath(  # triggers geolocation
        'geolocation', 'geolocation_on_load.html')
    match_text='file:/// wants to track your physical location.'
    self.NavigateToURL(url)
    self.assertTrue(self.WaitForInfobarCount(1))
    self._VerifyGeolocationInfobar(windex=0, tab_index=0, match_text=match_text)
    # Accept, and verify that the infobar went away
    self.PerformActionOnInfobar('accept', infobar_index=0)
    self.assertFalse(self._GetTabInfo()['infobars'])

  def testGeolocationInfobarInMultipleTabsAndWindows(self):
    """Verify GeoLocation inforbar in multiple tabs."""
    url = self.GetFileURLForDataPath(  # triggers geolocation
        'geolocation', 'geolocation_on_load.html')
    match_text='file:/// wants to track your physical location.'
    for tab_index in range(1, 2):
      self.AppendTab(pyauto.GURL(url))
      self.assertTrue(
          self.WaitForInfobarCount(1, windex=0, tab_index=tab_index))
      self._VerifyGeolocationInfobar(windex=0, tab_index=tab_index,
                                     match_text=match_text)
    # Try in a new window
    self.OpenNewBrowserWindow(True)
    self.NavigateToURL(url, 1, 0)
    self.assertTrue(self.WaitForInfobarCount(1, windex=1, tab_index=0))
    self._VerifyGeolocationInfobar(windex=1, tab_index=0, match_text=match_text)
    # Incognito window
    self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
    self.NavigateToURL(url, 2, 0)
    self.assertTrue(self.WaitForInfobarCount(1, windex=2, tab_index=0))
    self._VerifyGeolocationInfobar(windex=2, tab_index=0, match_text=match_text)

  def testMultipleDownloadsInfobar(self):
    """Verify the mutiple downloads infobar."""
    zip_file = 'a_zip_file.zip'
    html_file = 'download-a_zip_file.html'
    assert pyauto.PyUITest.IsEnUS()
    file_url = self.GetFileURLForDataPath('downloads', html_file)
    match_text = 'This site is attempting to download multiple files. ' \
                 'Do you want to allow this?'
    self.NavigateToURL('chrome://downloads')  # trigger download manager
    test_utils.RemoveDownloadedTestFile(self, zip_file)
    self.DownloadAndWaitForStart(file_url)
    # trigger page reload, which triggers the download infobar
    self.GetBrowserWindow(0).GetTab(0).Reload()
    self.assertTrue(self.WaitForInfobarCount(1))
    tab_info = self._GetTabInfo(0, 0)
    infobars = tab_info['infobars']
    self.assertTrue(infobars, 'Expected the multiple downloads infobar')
    self.assertEqual(1, len(infobars))
    self.assertEqual(match_text, infobars[0]['text'])
    self.assertEqual(2, len(infobars[0]['buttons']))
    self.assertEqual('Allow', infobars[0]['buttons'][0])
    self.assertEqual('Deny', infobars[0]['buttons'][1])
    self.WaitForAllDownloadsToComplete()
    test_utils.RemoveDownloadedTestFile(self, zip_file)

  def testPluginCrashForMultiTabs(self):
    """Verify plugin crash infobar shows up only on the tabs using plugin."""
    if self.IsMac():
      # On Mac 10.5, flash files loaded too quickly after firing browser ends
      # up getting downloaded, which seems to indicate that the plugin hasn't
      # been registered yet.
      # Hack to register Flash plugin on Mac 10.5.  crbug.com/94123
      self.GetPluginsInfo()
    non_flash_url = self.GetFileURLForDataPath('english_page.html')
    flash_url = self.GetFileURLForDataPath('plugin', 'FlashSpin.swf')
    # False = Non flash url, True = Flash url
    # We have set of these values to compare a flash page and a non-flash page
    urls_type = [False, True, False, True, False]
    for count in range(2):
      self.AppendTab(pyauto.GURL(flash_url))
      self.AppendTab(pyauto.GURL(non_flash_url))
    # Killing flash process
    child_processes = self.GetBrowserInfo()['child_processes']
    flash = [x for x in child_processes if
             x['type'] == self._flash_plugin_type and
             x['name'] == 'Shockwave Flash'][0]
    self.assertTrue(flash)
    self.Kill(flash['pid'])
    # Crash plugin infobar should show up in the second tab of this window
    # so passing window and tab argument in the wait for an infobar.
    self.assertTrue(self.WaitForInfobarCount(1, windex=0, tab_index=1))
    for i in range(len(urls_type)):
      # Verify that if page doesn't have flash plugin,
      # it should not have infobar popped-up
      self.ActivateTab(i)
      if not urls_type[i]:
        info = self.GetBrowserInfo()
        self.assertFalse(
            info['windows'][0]['tabs'][i]['infobars'],
            msg='Did not expect crash infobar in tab at index %d' % i)
      elif urls_type[i]:
        self.assertTrue(
            self.WaitForInfobarCount(1, windex=0, tab_index=i),
            msg='Expected crash infobar in tab at index %d' % i)
        infobar = self.GetBrowserInfo()['windows'][0]['tabs'][i]['infobars']
        self.assertEqual(infobar[0]['type'], 'confirm_infobar')
        self.assertEqual(len(infobar), 1)

if __name__ == '__main__':
  pyauto_functional.Main()
<|endoftext|>


<commit_before>from django import template
from chunks.models import Chunk
from django.utils.safestring import mark_safe

register = template.Library()

@register.simple_tag
def chunk(key):
    try:
        return mark_safe(Chunk.objects.get(key=key).content)
    except:
        return ''

@register.assignment_tag
def get_chunk(key):
    try:
        return Chunk.objects.get(key=key)
    except:
        return None
<commit_msg>Template tags fix for django 2.2<commit_after>from django import template
from chunks.models import Chunk
from django.utils.safestring import mark_safe

register = template.Library()

@register.simple_tag
def chunk(key):
    try:
        return mark_safe(Chunk.objects.get(key=key).content)
    except:
        return ''

@register.simple_tag
def get_chunk(key):
    try:
        return Chunk.objects.get(key=key)
    except:
        return None
<|endoftext|>


<commit_before>import os

def init(conf, indir):
    jsdir = conf.get('js', indir + '/js')
    cssdir = conf.get('css', indir + '/css')
    assets = os.path.dirname(os.path.dirname(__file__))
    if not os.path.exists(jsdir + '/wq'):
        os.symlink(assets + '/js', jsdir + '/wq')
    if not os.path.exists(cssdir + '/wq'):
        os.symlink(assets + '/css', cssdir + '/wq')
<commit_msg>update wq init to new structure<commit_after>import os

def init(conf, indir):
    jsdir = conf.get('js', indir + '/js')
    cssdir = conf.get('css', indir + '/css')
    assets = os.path.dirname(os.path.dirname(__file__))
    if not os.path.exists(jsdir + '/lib'):
        os.symlink(assets + '/js', jsdir + '/lib')
    if not os.path.exists(cssdir + '/lib'):
        os.symlink(assets + '/css', cssdir + '/lib')
<|endoftext|>


<commit_before>#!/usr/bin/env python
"""
Created on Feb 8, 2012

Author: Shareef M Dabdoub
"""
import sys
import re
import argparse
from phylotoast import biom_calc as bc, otu_calc as oc, util
try:
    import biom
except ImportError:
    sys.exit("Please install missing module: {}.".format("biom-format"))

def find_otu(otuid, tree):
    """
    Find an OTU ID in a Newick-format tree.
    Return the starting position of the ID or None if not found.
    """
    for m in re.finditer(otuid, tree):
        before, after = tree[m.start()-1], tree[m.start()+len(otuid)]
        if before in ["(", ",", ")"] and after in [":", ";"]:
            return m.start()
    return None

def newick_replace_otuids(tree, biomf):
    """
    Replace the OTU ids in the Newick phylogenetic tree format with truncated
    OTU names
    """
    for val, id_, md in biomf.iter(axis="observation"):
        otu_loc = find_otu(id_, tree)
        if otu_loc is not None:
            tree = tree[:otu_loc] + \
                   oc.otu_name(md["taxonomy"]) + \
                   tree[otu_loc + len(id_):]
    return tree

def handle_program_options():
    parser = argparse.ArgumentParser(description="Create files appropriate for\
                                     use in the iTol visualization program by \
                                     using the abundance data from a \
                                     biom-format file and groups specified in \
                                     a QIIME mapping file. The program also \
                                     modifies a Newick-format phylogenetic \
                                     tree file to use proper taxonomic names \
                                     instead of OTU IDs for useful display in \
                                     iTol.")
    parser.add_argument("-i", "--otu_table", required=True,
                        help="The biom-format file with OTU-Sample abundance \
                              data.")
    parser.add_argument("-m", "--mapping", required=True,
                        help="The mapping file specifying group information \
                              for each sample.")
    parser.add_argument("-t", "--input_tree", default="",
                        help="A phylogenetic tree in Newick format to be \
                              modified by exchanging the OTU ID node names for\
                              taxonomic names.")
    parser.add_argument("-e", "--output_tre", default="iTol.tre",
                        help="The output .tre file")
    parser.add_argument("-o", "--output_itol_table", default="iTol_table.txt",
                        help="Other than a phylogenetic tree, the main input \
                              to iTol is a dataset file containing some \
                              representation of the abundance of every OTU \
                              across the specified data groups. This program \
                              provides multiple calculation methods. See the \
                              --analysis_metric option for details.")
    parser.add_argument("-c", "--map_categories", default=None,
                        help="Any mapping categories, such as treatment type, \
                              that will be used to group the data in the \
                              output iTol table. For example, one category \
                              with three types will result in three data \
                              columns in the final output. Two categories with\
                              three types each will result in six data \
                              columns. Default is no categories and all the \
                              data will be treated as a single group.")
    parser.add_argument("-a", "--analysis_metric", default="MRA",
                        choices=["MRA", "NMRA", "raw"],
                        help="Specifies which metric is calculated on the \
                              abundance data in the OTU table. Available \
                              options: MRE - mean relative abundance \
                              (Abundance data is normalized by total sample \
                              abundance, then averaged across OTU), NMRE - \
                              normalized mean relative abundance (MRE \
                              normalized by the total MRE across the groups \
                              as specified in --map_categories), raw (outputs \
                              the actual sequence abundance data for \
                              each OTU).")
    parser.add_argument("--stabilize_variance", action="store_true",
                        default=False,
                        help="Apply the variance-stabilizing arcsine square\
                              root transformation to the OTU proportion data.")

    return parser.parse_args()

def main():
    args = handle_program_options()

    try:
        with open(args.otu_table):
            pass
    except IOError as ioe:
        sys.exit(
            "\nError with OTU_Sample abundance data file:{}\n"
            .format(ioe)
        )

    try:
        with open(args.mapping):
            pass
    except IOError as ioe:
        sys.exit(
            "\nError with mapping file:{}\n"
            .format(ioe)
        )

    # input data
    biomf = biom.load_table(args.otu_table)
    map_header, imap = util.parse_map_file(args.mapping)

    # rewrite tree file with otu names
    if args.input_tree:
        with open(args.input_tree) as treF, open(args.output_tre, "w") as outF:
            tree = treF.readline()
            if "'" in tree:
                tree = tree.replace("'", '')
            outF.write(newick_replace_otuids(tree, biomf))

    oid_rows = {id_: md["taxonomy"]
                for val, id_, md in biomf.iter(axis="observation")}

    # calculate analysis results
    categories = None
    if args.map_categories is not None:
        categories = args.map_categories.split(",")

    # set transform if --stabilize_variance is specfied
    tform = bc.arcsine_sqrt_transform if args.stabilize_variance else None

    groups = util.gather_categories(imap, map_header, categories)
    for group in groups.values():
        if args.analysis_metric in ["MRA", "NMRA"]:
            results = bc.MRA(biomf, group.sids, transform=tform)
        elif args.analysis_metric == "raw":
            results = bc.transform_raw_abundance(biomf, sampleIDs=group.sids,
                                                 sample_abd=False)
        group.results.update({oc.otu_name(oid_rows[oid]): results[oid]
                             for oid in results})

    # write iTol data set file
    with open(args.output_itol_table, "w") as itolF:
        if args.analysis_metric == "raw":
            itolF.write("DATASET_GRADIENT\nSEPARATOR TAB\n")
            itolF.write("DATASET_LABEL\tLog Total Abundance\n")
            itolF.write("COLOR\t#000000\n")
            itolF.write("LEGEND_TITLE\tLog Total Abundance\n")
            itolF.write("LEGEND_SHAPE\t1\n")
            itolF.write("LEGEND_COLORS\t#000000\n")
            itolF.write("LEGEND_LABELS\tLog Total Abundance\n")
            itolF.write("COLOR_MIN\t#FFFFFF\n")
            itolF.write("COLOR_MAX\t#000000\n")
        else:
            itolF.write("DATASET_MULTIBAR\nSEPARATOR TAB\n")
            itolF.write("DATASET_LABEL\tNMRA\n")
            itolF.write("FIELD_COLORS\t{}\n".format("\t".join(["#ff0000"
                        for _ in range(len(groups))])))
            itolF.write("FIELD_LABELS\t" + "\t".join(groups.keys())+"\n")
            itolF.write("LEGEND_TITLE\tNMRA\n")
            itolF.write("LEGEND_SHAPES\t1\t1\t1\t1\n")
            itolF.write("LEGEND_COLORS\t{}\n".format("\t".join(["#ff0000"
                        for _ in range(len(groups))])))
            itolF.write("LEGEND_LABELS\t" + "\t".join(groups.keys())+"\n")
            itolF.write("WIDTH\t300\n")
        itolF.write("DATA\n")
        all_otus = frozenset({oc.otu_name(md["taxonomy"])
                              for val, id_, md in
                              biomf.iter(axis="observation")})

        for oname in all_otus:
            row = ["{name}"]        # \t{s:.2f}\t{ns:.2f}\n"
            row_data = {"name": oname}
            msum = 0
            for name, group in groups.iteritems():
                row.append("{{{}:.5f}}".format(name))
                if oname in group.results:
                    row_data[name] = group.results[oname]
                else:
                    row_data[name] = 0.0
                msum += row_data[name]
            # normalize avg relative abundance data
            if args.analysis_metric == "NMRA" and msum > 0:
                row_data.update({key: data/msum
                                for key, data in row_data.items()
                                if key != "name"})
            itolF.write("\t".join(row).format(**row_data) + "\n")

if __name__ == "__main__":
    main()
<commit_msg>Update iTol.py<commit_after>#!/usr/bin/env python
"""
Created on Feb 8, 2012

Author: Shareef M Dabdoub
"""
import sys
import re
import argparse
from phylotoast import biom_calc as bc, otu_calc as oc, util
try:
    import biom
except ImportError:
    sys.exit("Please install missing module: {}.".format("biom-format"))

def find_otu(otuid, tree):
    """
    Find an OTU ID in a Newick-format tree.
    Return the starting position of the ID or None if not found.
    """
    for m in re.finditer(otuid, tree):
        before, after = tree[m.start()-1], tree[m.start()+len(otuid)]
        if before in ["(", ",", ")"] and after in [":", ";"]:
            return m.start()
    return None

def newick_replace_otuids(tree, biomf):
    """
    Replace the OTU ids in the Newick phylogenetic tree format with truncated
    OTU names
    """
    for val, id_, md in biomf.iter(axis="observation"):
        otu_loc = find_otu(id_, tree)
        if otu_loc is not None:
            tree = tree[:otu_loc] + \
                   oc.otu_name(md["taxonomy"]) + \
                   tree[otu_loc + len(id_):]
    return tree

def handle_program_options():
    parser = argparse.ArgumentParser(description="Create files appropriate for\
                                     use in the iTol visualization program by \
                                     using the abundance data from a \
                                     biom-format file and groups specified in \
                                     a QIIME mapping file. The program also \
                                     modifies a Newick-format phylogenetic \
                                     tree file to use proper taxonomic names \
                                     instead of OTU IDs for useful display in \
                                     iTol.")
    parser.add_argument("-i", "--otu_table", required=True,
                        help="The biom-format file with OTU-Sample abundance \
                              data.")
    parser.add_argument("-m", "--mapping", required=True,
                        help="The mapping file specifying group information \
                              for each sample.")
    parser.add_argument("-t", "--input_tree", default="",
                        help="A phylogenetic tree in Newick format to be \
                              modified by exchanging the OTU ID node names for\
                              taxonomic names.")
    parser.add_argument("-e", "--output_tre", default="iTol.tre",
                        help="The output .tre file")
    parser.add_argument("-o", "--output_itol_table", default="iTol_table.txt",
                        help="Other than a phylogenetic tree, the main input \
                              to iTol is a dataset file containing some \
                              representation of the abundance of every OTU \
                              across the specified data groups. This program \
                              provides multiple calculation methods. See the \
                              --analysis_metric option for details.")
    parser.add_argument("-c", "--map_categories", default=None,
                        help="Any mapping categories, such as treatment type, \
                              that will be used to group the data in the \
                              output iTol table. For example, one category \
                              with three types will result in three data \
                              columns in the final output. Two categories with\
                              three types each will result in six data \
                              columns. Default is no categories and all the \
                              data will be treated as a single group.")
    parser.add_argument("-a", "--analysis_metric", default="MRA",
                        choices=["MRA", "NMRA", "raw"],
                        help="Specifies which metric is calculated on the \
                              abundance data in the OTU table. Available \
                              options: MRE - mean relative abundance \
                              (Abundance data is normalized by total sample \
                              abundance, then averaged across OTU), NMRE - \
                              normalized mean relative abundance (MRE \
                              normalized by the total MRE across the groups \
                              as specified in --map_categories), raw (outputs \
                              the actual sequence abundance data for \
                              each OTU).")
    parser.add_argument("--stabilize_variance", action="store_true",
                        default=False,
                        help="Apply the variance-stabilizing arcsine square\
                              root transformation to the OTU proportion data.")

    return parser.parse_args()

def main():
    args = handle_program_options()

    try:
        with open(args.otu_table):
            pass
    except IOError as ioe:
        sys.exit(
            "\nError with OTU_Sample abundance data file:{}\n"
            .format(ioe)
        )

    try:
        with open(args.mapping):
            pass
    except IOError as ioe:
        sys.exit(
            "\nError with mapping file:{}\n"
            .format(ioe)
        )

    # input data
    biomf = biom.load_table(args.otu_table)
    map_header, imap = util.parse_map_file(args.mapping)

    # rewrite tree file with otu names
    if args.input_tree:
        with open(args.input_tree) as treF, open(args.output_tre, "w") as outF:
            tree = treF.readline()
            if "'" in tree:
                tree = tree.replace("'", '')
            outF.write(newick_replace_otuids(tree, biomf))

    oid_rows = {id_: md["taxonomy"]
                for val, id_, md in biomf.iter(axis="observation")}

    # calculate analysis results
    categories = None
    if args.map_categories is not None:
        categories = args.map_categories.split(",")

    # set transform if --stabilize_variance is specfied
    tform = bc.arcsine_sqrt_transform if args.stabilize_variance else None

    groups = util.gather_categories(imap, map_header, categories)
    for group in groups.values():
        if args.analysis_metric in ["MRA", "NMRA"]:
            results = bc.MRA(biomf, group.sids, transform=tform)
        elif args.analysis_metric == "raw":
            results = bc.transform_raw_abundance(biomf, sampleIDs=group.sids,
                                                 sample_abd=False)
        group.results.update({oc.otu_name(oid_rows[oid]): results[oid]
                             for oid in results})

    # write iTol data set file
    with open(args.output_itol_table, "w") as itolF:
        if args.analysis_metric == "raw":
            itolF.write("DATASET_GRADIENT\nSEPARATOR TAB\n")
            itolF.write("DATASET_LABEL\tLog Total Abundance\n")
            itolF.write("COLOR\t#000000\n")
            itolF.write("LEGEND_TITLE\tLog Total Abundance\n")
            itolF.write("LEGEND_SHAPES\t1\n")
            itolF.write("LEGEND_COLORS\t#000000\n")
            itolF.write("LEGEND_LABELS\tLog Total Abundance\n")
            itolF.write("COLOR_MIN\t#FFFFFF\n")
            itolF.write("COLOR_MAX\t#000000\n")
        else:
            itolF.write("DATASET_MULTIBAR\nSEPARATOR TAB\n")
            itolF.write("DATASET_LABEL\tNMRA\n")
            itolF.write("FIELD_COLORS\t{}\n".format("\t".join(["#ff0000"
                        for _ in range(len(groups))])))
            itolF.write("FIELD_LABELS\t" + "\t".join(groups.keys())+"\n")
            itolF.write("LEGEND_TITLE\tNMRA\n")
            itolF.write("LEGEND_SHAPES\t{}\n".format("\t".join(["1"
                        for _ in range(len(groups))])))
            itolF.write("LEGEND_COLORS\t{}\n".format("\t".join(["#ff0000"
                        for _ in range(len(groups))])))
            itolF.write("LEGEND_LABELS\t" + "\t".join(groups.keys())+"\n")
            itolF.write("WIDTH\t300\n")
        itolF.write("DATA\n")
        all_otus = frozenset({oc.otu_name(md["taxonomy"])
                              for val, id_, md in
                              biomf.iter(axis="observation")})

        for oname in all_otus:
            row = ["{name}"]        # \t{s:.2f}\t{ns:.2f}\n"
            row_data = {"name": oname}
            msum = 0
            for name, group in groups.iteritems():
                row.append("{{{}:.5f}}".format(name))
                if oname in group.results:
                    row_data[name] = group.results[oname]
                else:
                    row_data[name] = 0.0
                msum += row_data[name]
            # normalize avg relative abundance data
            if args.analysis_metric == "NMRA" and msum > 0:
                row_data.update({key: data/msum
                                for key, data in row_data.items()
                                if key != "name"})
            itolF.write("\t".join(row).format(**row_data) + "\n")

if __name__ == "__main__":
    main()
<|endoftext|>


<commit_before>#!/usr/bin/env python

"""Show information about the `knowhow` index.

Usage:
  info.py
  info.py (-h | --help)
  info.py --version

Options:
  -h --help             Show this screen.
  --version             Show version.
"""

import sys

from docopt import docopt

import knowhow
from knowhow.index import Index

def print_info(reader):
    tags = (t.decode('utf-8') for t in reader.lexicon('tag'))
    print('tags:', ', '.join(tags))
    print('tag counts:')
    print('  ', reader.most_frequent_terms('tag'))

def main(args):
    index = Index()
    print('%d snippet(s)' % len(index))
    with index.ix.reader() as reader:
        print_info(reader)
    return 0

if __name__ == '__main__':
    arguments = docopt(__doc__, version=knowhow.__version__)
    sys.exit(main(arguments))
<commit_msg>cleanup<commit_after>#!/usr/bin/env python

"""Show information about the `knowhow` index.

Usage:
  info.py
  info.py (-h | --help)
  info.py --version

Options:
  -h --help             Show this screen.
  --version             Show version.
"""

import sys

from docopt import docopt

import knowhow
from knowhow.index import Index

def print_info(reader):
    print('%d snippet(s)' % reader.doc_count())
    tags = (t.decode('utf-8') for t in reader.lexicon('tag'))
    print('all tags:', ', '.join(tags))
    print('most frequent tags:')
    for count, term in reader.most_frequent_terms('tag'):
        print('    {0}: {1}'.format(count, term))

def main(args):
    with Index().ix.reader() as reader:
        print_info(reader)
    return 0

if __name__ == '__main__':
    arguments = docopt(__doc__, version=knowhow.__version__)
    sys.exit(main(arguments))
<|endoftext|>


<commit_before>#!/usr/bin/env python
# -*- coding: utf8 -*-

"""
Synchronize directory groups

This script copies all members of a list of groups to another group. Members
may be replaced or added.

If a member of a target group is objectClass=group, it will not be purged.

(c) 2015, Simon Wunderlin
"""

# setup paths
import os, sys, socket
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'etc'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))

# import modules
import dirtools
import dirsync
import logging
from logging.handlers import TimedRotatingFileHandler

def read_config():
	""" this method looks for a config file in etc/`hostname`.py. The file
	    is treated like a regular python file (__import__) and if successfuly
	    imported the file's attributes will be returned as a dict.
	"""

	# configuration
	config = {}

	# resolve path to current file
	basepath = os.path.dirname(os.path.realpath(__file__)) + "/"

	# get hostname
	hostname = socket.gethostname()

	# path to config file directory
	configpath = os.path.realpath(basepath+'../etc')

	# file containing configuration for this host
	configfile = os.path.realpath(configpath+'/%s.py' % hostname)

	# file containing pasword for this host (whitespace stripped)
	passfile = os.path.realpath(configpath+'/%s.pass' % hostname)

	# add config directory to include paths
	sys.path.append(configpath)
	try:
		# include config file
		cfgfile = __import__(hostname)
	except:
		# most probably the file doe not exist or is not readable
		e = sys.exc_info()[0]
		msg = "Failed to read config file '%s', make sure it exists." % (configfile)
		sys.stderr.write(msg+"\n")
		sys.stderr.write(str(e))
		sys.exit(2)

	# copy all attributes for configfile to config
	attrs = [a for a in dir(cfgfile) if not a.startswith('__')]
	for a in attrs:
		config[a] = getattr(cfgfile, a)

	# read password from file
	try:
		with open(passfile) as f:
			config["userpw"] = f.read()
			config["userpw"] = config["userpw"].strip() # remove trailing whitespace
	except:
		# most probably the file doe not exist or is not readable
		e = sys.exc_info()[0]
		print("Error while loading password file %s") % passfile
		sys.stderr.write(str(e))
		sys.exit(3)

	return config

def get_logger(logfile, service_name, level):
	# Logger initialisieren
	l = logging.getLogger(service_name)
	l.setLevel(level)

	# log rotation every day
	fh = TimedRotatingFileHandler(logfile, 'midnight') # logrotation, 1 file per day
	fh.setLevel(level)

	# standard unix log file format
	formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
	fh.setFormatter(formatter)
	l.addHandler(fh)

	# log startup
	l.info('==> Starting ' + service_name)

	return l

if __name__ == "__main__":
	"""
	LOG LEVELS:
		CRITICAL	50
		ERROR	40
		WARNING	30
		INFO	20
		DEBUG	10
		NOTSET	0
	"""
	log_level = logging.DEBUG

	# read configuration and password files from etc. the config file fo this host
	# is looked up under ../etc/`hostname`.py, the pw file under
	# ../etc/`hostname`.pass
	config = read_config()

	# set up logging
	log_file = config["modification_logfile"]
	if config["modification_logfile"][0] != "/":
		log_file = os.path.dirname(__file__) + "/../" + config["modification_logfile"]
	log = get_logger(log_file, "ldap_sync", log_level)

	log.info("Connecting to %s" % (config["ldap_url"]))
	log.info("BindDN %s" % (config["userdn"]))

	# connect to ldap server
	try:
		l = dirtools.connect(config["ldap_url"], config["userdn"], config["userpw"])
	except:
		log.critical("Failed to connect")
		sys.exit(2)

	# loop over all items which have to be synced
	for entry in config["sync"]:
		log.info("Syncing %s" % entry["from"])

		# do a subtree search with our filter from the configuration
		res = dirtools.search(entry["from"], config["baseDN"], True)

		# LDAP results contain entries with empty DNs, at least this is what
		# Microsoft's AD returns. These empty entries are ldap urls pointing to
		# other directory trees. This is obsolete as of LDAPv3, so we ignore them.
		num_records = dirtools.len(res)
		log.debug("Number of entries found by search: %d" % num_records)

		# find all members of all DNs
		cnlist = []
		for r in res:
			if r[0] == None: # skip ldap referers
				continue
			try:
				cnlist = cnlist + r[1]["member"]
			except:
				log.warn("%s does not have a member attribute" % r[0])

		log.info("Found %d members in src DNs" % len(cnlist))

		# decide which method to use: copy, sync or delete
		log.info("Wiriting to %s" % entry["to"])

		#from pprint import pprint
		#pprint(entry)

		if entry["method"] == "sync":
			# copy all members from src to target, deleting everything not in src
			ret = dirsync.member_sync(l, cnlist, entry["to"])
		elif entry["method"] == "copy":
			# copy all from src to tgt, preserving existing members in tgt
			ret = dirsync.member_copy(l, cnlist, entry["to"])
		elif entry["method"] == "delete":
			# delete all members
			raise ValueError('Method delete not implemented')
		else:
			raise ValueError('Unknown method: %s' % entry["method"])

		log.info("result: " + str(ret))

	# all done, close connection to ldap server
	log.debug("Disconnecting from %s" % config["ldap_url"])
	dirtools.disconnect()

<commit_msg>added patch to ignore MQ_ANA_ groups in dirsync.py<commit_after>#!/usr/bin/env python
# -*- coding: utf8 -*-

"""
Synchronize directory groups

This script copies all members of a list of groups to another group. Members
may be replaced or added.

If a member of a target group is objectClass=group, it will not be purged.

(c) 2015, Simon Wunderlin
"""

# setup paths
import os, sys, socket
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'etc'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))

# import modules
import dirtools
import dirsync
import logging
from logging.handlers import TimedRotatingFileHandler

def read_config():
	""" this method looks for a config file in etc/`hostname`.py. The file
	    is treated like a regular python file (__import__) and if successfuly
	    imported the file's attributes will be returned as a dict.
	"""

	# configuration
	config = {}

	# resolve path to current file
	basepath = os.path.dirname(os.path.realpath(__file__)) + "/"

	# get hostname
	hostname = socket.gethostname()

	# path to config file directory
	configpath = os.path.realpath(basepath+'../etc')

	# file containing configuration for this host
	configfile = os.path.realpath(configpath+'/%s.py' % hostname)

	# file containing pasword for this host (whitespace stripped)
	passfile = os.path.realpath(configpath+'/%s.pass' % hostname)

	# add config directory to include paths
	sys.path.append(configpath)
	try:
		# include config file
		cfgfile = __import__(hostname)
	except:
		# most probably the file doe not exist or is not readable
		e = sys.exc_info()[0]
		msg = "Failed to read config file '%s', make sure it exists." % (configfile)
		sys.stderr.write(msg+"\n")
		sys.stderr.write(str(e))
		sys.exit(2)

	# copy all attributes for configfile to config
	attrs = [a for a in dir(cfgfile) if not a.startswith('__')]
	for a in attrs:
		config[a] = getattr(cfgfile, a)

	# read password from file
	try:
		with open(passfile) as f:
			config["userpw"] = f.read()
			config["userpw"] = config["userpw"].strip() # remove trailing whitespace
	except:
		# most probably the file doe not exist or is not readable
		e = sys.exc_info()[0]
		print("Error while loading password file %s") % passfile
		sys.stderr.write(str(e))
		sys.exit(3)

	return config

def get_logger(logfile, service_name, level):
	# Logger initialisieren
	l = logging.getLogger(service_name)
	l.setLevel(level)

	# log rotation every day
	fh = TimedRotatingFileHandler(logfile, 'midnight') # logrotation, 1 file per day
	fh.setLevel(level)

	# standard unix log file format
	formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
	fh.setFormatter(formatter)
	l.addHandler(fh)

	# log startup
	l.info('==> Starting ' + service_name)

	return l

if __name__ == "__main__":
	"""
	LOG LEVELS:
		CRITICAL	50
		ERROR	40
		WARNING	30
		INFO	20
		DEBUG	10
		NOTSET	0
	"""
	log_level = logging.DEBUG

	# read configuration and password files from etc. the config file fo this host
	# is looked up under ../etc/`hostname`.py, the pw file under
	# ../etc/`hostname`.pass
	config = read_config()

	# set up logging
	log_file = config["modification_logfile"]
	if config["modification_logfile"][0] != "/":
		log_file = os.path.dirname(__file__) + "/../" + config["modification_logfile"]
	log = get_logger(log_file, "ldap_sync", log_level)

	log.info("Connecting to %s" % (config["ldap_url"]))
	log.info("BindDN %s" % (config["userdn"]))

	# connect to ldap server
	try:
		l = dirtools.connect(config["ldap_url"], config["userdn"], config["userpw"])
	except:
		log.critical("Failed to connect")
		sys.exit(2)

	# loop over all items which have to be synced
	for entry in config["sync"]:
		log.info("Syncing %s" % entry["from"])

		# do a subtree search with our filter from the configuration
		res = dirtools.search(entry["from"], config["baseDN"], True)

		# LDAP results contain entries with empty DNs, at least this is what
		# Microsoft's AD returns. These empty entries are ldap urls pointing to
		# other directory trees. This is obsolete as of LDAPv3, so we ignore them.
		num_records = dirtools.len(res)
		log.debug("Number of entries found by search: %d" % num_records)

		# find all members of all DNs
		cnlist = []
		for r in res:
			if r[0] == None: # skip ldap referers
				continue

			try:
				cnlist = cnlist + r[1]["member"]
			except:
				log.warn("%s does not have a member attribute" % r[0])

		log.info("Found %d members in src DNs" % len(cnlist))

		# decide which method to use: copy, sync or delete
		log.info("Wiriting to %s" % entry["to"])

		#from pprint import pprint
		#pprint(entry)

		final_cn = []
		for e in cnlist:
			if e[0:10] != "CN=MQ_ANA_":
				final_cn = final_cn + [e]

		if entry["method"] == "sync":
			# copy all members from src to target, deleting everything not in src
			#import pprint
			#print entry["to"]
			#pprint.pprint(final_cn)
			ret = dirsync.member_sync(l, final_cn, entry["to"])
		elif entry["method"] == "copy":
			# copy all from src to tgt, preserving existing members in tgt
			ret = dirsync.member_copy(l, cnlist, entry["to"])
		elif entry["method"] == "delete":
			# delete all members
			raise ValueError('Method delete not implemented')
		else:
			raise ValueError('Unknown method: %s' % entry["method"])

		log.info("result: " + str(ret))

	# all done, close connection to ldap server
	log.debug("Disconnecting from %s" % config["ldap_url"])
	dirtools.disconnect()

<|endoftext|>


<commit_before>{
	"target_defaults": {
		"include_dirs": [
			"<!(node -e \"require('nan')\")"
		],
		"libraries":
			[ '<!@(if test "x${EXTERNAL_OCTBSTACK}x" = "xx"; then echo "-L$(pwd)/deps/iotivity/lib -loctbstack -Wl,-rpath $(pwd)/deps/iotivity/lib"; else echo "$OCTBSTACK_LIBS"; fi)' ],
		"cflags":
			[ '<!@(if test "x${EXTERNAL_OCTBSTACK}x" = "xx"; then echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/csdk/stack/include"; else echo "$OCTBSTACK_CFLAGS"; fi)' ],
		"cflags_cc": [ '-std=c++11' ],
		"xcode_settings": {
			"OTHER_CFLAGS":
				[ '<!@(if test "x${EXTERNAL_OCTBSTACK}x" = "xx"; then echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/csdk/stack/include"; else echo "$OCTBSTACK_CFLAGS"; fi)' ]
		}
	},
	"targets": [
		{
			"target_name": "csdk",
			"actions": [ {
				"action_name": "build",
				"inputs": [],
				"outputs": [
					"deps/iotivity/lib/liboctbstack.so",
					"deps/iotivity/include"
				],
				"action": [ "sh",  "./build-csdk.sh" ],
				"message": "Building CSDK"
			} ]
		},
		{
			"target_name": "iotivity",
			"sources": [
				"src/main.cc",
				"src/common.cc",
				"src/enums.cc",
				"src/constants.cc",
				"src/structures.cc",
				"src/functions/oc-create-delete-resource.cc",
				"src/functions/oc-do-resource.cc",
				"src/functions/oc-do-response.cc",
				"src/functions/oc-notify.cc",
				"src/functions/simple.cc",
				"src/functions.cc",
				"src/callback-info.c"
			],
			"libraries": [ "<(PRODUCT_DIR)/libffi.a" ],
			"conditions": [
				[ "'<!(echo $TESTING)'=='true'",
						{ "defines": [ "TESTING" ] } ]
			],
			"dependencies": [
				"csdk",
				"node_modules/ffi/deps/libffi/libffi.gyp:ffi"
			]
		},
		{
			"target_name": "client",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/client.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "client.observe",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/client.observe.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "server",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/server.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "server.observable",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/server.observable.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		}
	]
}
<commit_msg>Build: Use conditionals to respect external octbstack<commit_after>{
	"target_defaults": {
		"include_dirs": [
			"<!(node -e \"require('nan')\")"
		],
		"conditions": [
			[ "'<!(echo $EXTERNAL_OCTBSTACK)'==''", {
				"libraries": [
					'<!@(echo "-L$(pwd)/deps/iotivity/lib -loctbstack -Wl,-rpath $(pwd)/deps/iotivity/lib")'
				],
				"cflags": [
					'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/csdk/stack/include")'
				],
				"xcode_settings": {
					"OTHER_CFLAGS": [
						'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/csdk/stack/include")'
					]
				}
			} ],
			[ "'<!(echo $EXTERNAL_OCTBSTACK)'!=''", {
				"libraries": [ '<!@(echo "$OCTBSTACK_LIBS")' ],
				"cflags": [ '<!@(echo "$OCTBSTACK_CFLAGS")' ],
				"xcode_settings": {
					"OTHER_CFLAGS": [ '<!@(echo "$OCTBSTACK_CFLAGS")' ]
				}
			} ]
		],
		"cflags_cc": [ '-std=c++11' ]
	},
	"targets": [
		{
			"target_name": "csdk",
			"conditions": [
				[ "'<!(echo $EXTERNAL_OCTBSTACK)'==''", {
					"actions": [ {
						"action_name": "build",
						"inputs": [],
						"outputs": [
							"deps/iotivity/lib/liboctbstack.so",
							"deps/iotivity/include"
						],
						"action": [ "sh",  "./build-csdk.sh" ],
						"message": "Building CSDK"
					} ]
				} ]
			]
		},
		{
			"target_name": "iotivity",
			"sources": [
				"src/main.cc",
				"src/common.cc",
				"src/enums.cc",
				"src/constants.cc",
				"src/structures.cc",
				"src/functions/oc-create-delete-resource.cc",
				"src/functions/oc-do-resource.cc",
				"src/functions/oc-do-response.cc",
				"src/functions/oc-notify.cc",
				"src/functions/simple.cc",
				"src/functions.cc",
				"src/callback-info.c"
			],
			"libraries": [ "<(PRODUCT_DIR)/libffi.a" ],
			"conditions": [
				[ "'<!(echo $TESTING)'=='true'",
						{ "defines": [ "TESTING" ] } ]
			],
			"dependencies": [
				"csdk",
				"node_modules/ffi/deps/libffi/libffi.gyp:ffi"
			]
		},
		{
			"target_name": "client",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/client.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "client.observe",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/client.observe.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "server",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/server.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		},
		{
			"target_name": "server.observable",
			"dependencies": [ "csdk" ],
			"type": "executable",
			"sources": [ "c/server.observable.c" ],
			"libraries": [ '<!(pkg-config --libs glib-2.0)' ],
			"cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
			"xcode_settings": {
				"OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
				"OTHER_LDFLAGS": [
					'-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
				]
			}
		}
	]
}
<|endoftext|>


<commit_before>{
  "targets": [
    {
      "target_name": "binding",
      "sources": [ "src/binding.cc" ],
      "include_dirs": ["deps/rocksdb/include"],
      "libraries": ["../deps/rocksdb/librocksdb.a", "-lsnappy", "-lz", "-lbz2"],
      "xcode_settings": {
        "MACOSX_DEPLOYMENT_TARGET": "10.8",
        "OTHER_CPLUSPLUSFLAGS" : ["-std=c++11", "-stdlib=libc++"],
        "OTHER_LDFLAGS": ["-stdlib=libc++"]
      },
      "cflags": ["-std=c++11", "-stdlib=libc++"]
    }
  ]
}<commit_msg>Remove libc++ from linux build.<commit_after>{
  "targets": [
    {
      "target_name": "binding",
      "sources": [ "src/binding.cc" ],
      "include_dirs": ["deps/rocksdb/include"],
      "libraries": ["../deps/rocksdb/librocksdb.a", "-lsnappy", "-lz", "-lbz2"],
      "xcode_settings": {
        "MACOSX_DEPLOYMENT_TARGET": "10.8",
        "OTHER_CPLUSPLUSFLAGS" : ["-std=c++11", "-stdlib=libc++"],
        "OTHER_LDFLAGS": ["-stdlib=libc++"]
      },
      "cflags": ["-std=c++11"]
    }
  ]
}<|endoftext|>