Ejemplo n.º 1
0
def test_deprecated_module():
    with _test_deprecation() as extract_deprecation_warning:
        # Note: Attempting to import here a dummy module that just calls deprecated_module() does not
        # properly trigger the deprecation, due to a bad interaction with pytest that I've not fully
        # understood.  But we trust python to correctly execute modules on import, so just testing a
        # direct call of deprecated_module() here is fine.
        deprecated_module(FUTURE_VERSION, hint_message="Do not use me.")
        warning_message = str(extract_deprecation_warning())
        assert "Module is deprecated" in warning_message
        assert "Do not use me" in warning_message
Ejemplo n.º 2
0
 def test_deprecated_module(self):
     with self._test_deprecation() as extract_deprecation_warning:
         # Note: Attempting to import here a dummy module that just calls deprecated_module() does not
         # properly trigger the deprecation, due to a bad interaction with pytest that I've not fully
         # understood.  But we trust python to correctly execute modules on import, so just testing a
         # direct call of deprecated_module() here is fine.
         deprecated_module(self.FUTURE_VERSION, hint_message="Do not use me.")
         warning_message = str(extract_deprecation_warning())
         self.assertIn("module will be removed", warning_message)
         self.assertIn("Do not use me", warning_message)
Ejemplo n.º 3
0
 def test_deprecated_module(self):
   with self._test_deprecation() as extract_deprecation_warning:
     # Note: Attempting to import here a dummy module that just calls deprecated_module() does not
     # properly trigger the deprecation, due to a bad interaction with pytest that I've not fully
     # understood.  But we trust python to correctly execute modules on import, so just testing a
     # direct call of deprecated_module() here is fine.
     deprecated_module(self.FUTURE_VERSION, hint_message='Do not use me.')
     warning_message = str(extract_deprecation_warning())
     self.assertIn('module will be removed', warning_message)
     self.assertIn('Do not use me', warning_message)
Ejemplo n.º 4
0
def test_deprecated_module():
    with _test_deprecation() as extract_deprecation_warning:
        # Note: Attempting to import here a dummy module that just calls deprecated_module() does not
        # properly trigger the deprecation, due to a bad interaction with pytest that I've not fully
        # understood.  But we trust python to correctly execute modules on import, so just testing a
        # direct call of deprecated_module() here is fine.
        deprecated_module(FUTURE_VERSION, hint_message='Do not use me.')
        warning_message = str(extract_deprecation_warning())
        assert 'Module is deprecated' in warning_message
        assert 'Do not use me' in warning_message
Ejemplo n.º 5
0
def deprecated_testinfra_module(instead=None):
    if not instead:
        caller_frame_info = inspect.stack()[1]
        caller_module = inspect.getmodule(caller_frame_info.frame)
        caller_module_name = caller_module.__name__
        assert caller_module_name.startswith('pants_test.'), (
            'The `deprecated_testinfra_module` helper should only be used in `pants_test` code that has '
            'been deprecated in favor of `pants.testutil` equivalent code. Detected use from module '
            f'{caller_module_name}.')
        instead = f'pants.testutil.{caller_module_name.lstrip("pants_test.")}'

    deprecated_module(
        removal_version='1.26.0.dev1',
        hint_message=
        f'Import {instead} from the pantsbuild.pants.testutil distribution instead.',
        stacklevel=4)
Ejemplo n.º 6
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.scm_publish_mixin import Namedver, ScmPublishMixin, Semver, Version


deprecated_module('0.0.66',
                  hint_message='pants.backend.core.tasks.scm_publish has moved to '
                               'pants.task.scm_publish_mixin. Replace deps on '
                               'src/python/pants/backend/core/tasks:scm_publish and on '
                               'src/python/pants/backend/core/tasks:all with a dep on '
                               'src/python/pants/task and change imports accordingly.')

Version = Version
Namedver = Namedver
Semver = Semver
ScmPublishMixin = ScmPublishMixin
Ejemplo n.º 7
0
def test_deprecated_module(caplog) -> None:
    assert not caplog.records
    deprecated_module(FUTURE_VERSION, hint="Do not use me.")
    assert len(caplog.records) == 1
    assert "module will be removed" in caplog.text
    assert "Do not use me" in caplog.text
Ejemplo n.º 8
0
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.file_test_util import check_file_content as check_file_content  # noqa
from pants.testutil.file_test_util import check_symlinks as check_symlinks  # noqa
from pants.testutil.file_test_util import contains_exact_files as contains_exact_files  # noqa
from pants.testutil.file_test_util import exact_files as exact_files  # noqa

deprecated_module(removal_version="1.25.0.dev0",
                  hint_message="Import pants.testutil.file_test_util instead.")
Ejemplo n.º 9
0
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.option.fakes import _FakeOptionValues as _FakeOptionValues  # noqa
from pants.testutil.option.fakes import (
    _options_registration_function as _options_registration_function, )  # noqa
from pants.testutil.option.fakes import create_options as create_options  # noqa
from pants.testutil.option.fakes import (
    create_options_for_optionables as create_options_for_optionables, )  # noqa

deprecated_module(removal_version="1.25.0.dev0",
                  hint_message="Import pants.testutil.option.fakes instead.")
Ejemplo n.º 10
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.codegen.wire.java.java_wire_library import JavaWireLibrary
from pants.base.deprecated import deprecated_module


deprecated_module('1.5.0dev0', 'Use pants.backend.codegen.wire.java instead')

JavaWireLibrary = JavaWireLibrary
Ejemplo n.º 11
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.codegen.thrift.python.python_thrift_library import PythonThriftLibrary
from pants.base.deprecated import deprecated_module


deprecated_module('1.5.0dev0', 'Use pants.backend.codegen.thrift.python instead')

PythonThriftLibrary = PythonThriftLibrary
Ejemplo n.º 12
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.prep_command import PrepCommand


deprecated_module('0.0.66',
                  hint_message='pants.backend.core.targets.prep_command has moved to '
                               'pants.build_graph.prep_command. Replace deps on '
                               'src/python/pants/backend/core/targets:all or '
                               'src/python/pants/backend/core/targets:common with a dep on '
                               'src/python/pants/build_graph and change imports accordingly.')


PrepCommand = PrepCommand
Ejemplo n.º 13
0
from pants.backend.jvm.tasks.ivy_task_mixin import IvyTaskMixin
from pants.backend.jvm.tasks.nailgun_task import NailgunTask
from pants.backend.python.targets.python_tests import PythonTests
from pants.base.build_environment import get_buildroot
from pants.base.build_file import BuildFile
from pants.base.deprecated import deprecated_module
from pants.base.exceptions import TaskError
from pants.base.project_tree_factory import get_project_tree
from pants.build_graph.address import BuildFileAddress
from pants.build_graph.resources import Resources
from pants.util import desktop
from pants.util.dirutil import safe_mkdir, safe_walk

deprecated_module(
    '1.7.0.dev0',
    'IDE project generation functionality will be removed entirely.  Use the'
    'Pants IntelliJ plugin, or discuss alternative solutions with the Pants team.'
)

logger = logging.getLogger(__name__)


# We use custom checks for scala and java targets here for 2 reasons:
# 1.) jvm_binary could have either a scala or java source file attached so we can't do a pure
#     target type test
# 2.) the target may be under development in which case it may not have sources yet - its pretty
#     common to write a BUILD and ./pants idea the target inside to start development at which
#     point there are no source files yet - and the developer intents to add them using the ide.
def is_scala(target):
    return (isinstance(target, ScalaLibrary)
            or isinstance(target, JvmTarget) and target.has_sources('.scala'))
Ejemplo n.º 14
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module

from pants.contrib.python.checks.tasks.python_eval import PythonEval


deprecated_module('1.7.0.dev0', 'Use pants.contrib.python.checks.tasks instead')

PythonEval = PythonEval
Ejemplo n.º 15
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (
    absolute_import,
    division,
    generators,
    nested_scopes,
    print_function,
    unicode_literals,
    with_statement,
)

from pants.base.deprecated import deprecated_module
from pants.task.simple_codegen_task import SimpleCodegenTask


deprecated_module("1.5.0", "Use pants.task.simple_codegen_task instead")

SimpleCodegenTask = SimpleCodegenTask
Ejemplo n.º 16
0
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.build_graph.build_file_parser import BuildFileParser
from pants.build_graph.mutable_build_graph import MutableBuildGraph
from pants.build_graph.target import Target
from pants.init.util import clean_global_runtime_state
from pants.option.options_bootstrapper import OptionsBootstrapper
from pants.option.scope import GLOBAL_SCOPE
from pants.source.source_root import SourceRootConfig
from pants.subsystem.subsystem import Subsystem
from pants.task.goal_options_mixin import GoalOptionsMixin
from pants.util.dirutil import safe_mkdir, safe_open, safe_rmtree
from pants_test.base.context_utils import create_context_from_options
from pants_test.option.util.fakes import create_options_for_optionables


deprecated_module('1.10.0.dev0', 'Use pants_test.test_base instead')


class TestGenerator(object):
  """A mixin that facilitates test generation at runtime."""

  @classmethod
  def generate_tests(cls):
    """Generate tests for a given class.

    This should be called against the composing class in it's defining module, e.g.

      class ThingTest(TestGenerator):
        ...

      ThingTest.generate_tests()
Ejemplo n.º 17
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.codegen.thrift.java.thrift_defaults import ThriftDefaults
from pants.base.deprecated import deprecated_module


deprecated_module('1.5.0dev0', 'Use pants.backend.codegen.thrift.java.thrift_defaults instead')

ThriftDefaults = ThriftDefaults
Ejemplo n.º 18
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.graph_info.tasks.filter import Filter
from pants.base.deprecated import deprecated_module


deprecated_module('0.0.66',
                  hint_message='pants.backend.core.tasks.filter has moved to '
                               'pants.backend.graph_info.tasks. Replace deps on '
                               'src/python/pants/backend/core/tasks:* with a dep on '
                               'src/python/pants/backend/graph_info/tasks and change '
                               'imports accordingly.')


Filter = Filter
Ejemplo n.º 19
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.build_file_aliases import BuildFileAliases, TargetMacro


deprecated_module('0.0.53', hint_message='Use pants.build_graph.build_file_aliases instead.')

TargetMacro = TargetMacro
BuildFileAliases = BuildFileAliases
Ejemplo n.º 20
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.simple_codegen_task import SimpleCodegenTask


deprecated_module('1.5.0.dev0', 'Use pants.task.simple_codegen_task instead')

SimpleCodegenTask = SimpleCodegenTask
Ejemplo n.º 21
0
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.mock_logger import MockLogger as MockLogger  # noqa

deprecated_module(removal_version="1.25.0.dev0",
                  hint_message="Import pants.testutil.mock_logger instead.")
Ejemplo n.º 22
0
import os
from contextlib import closing, contextmanager
from io import BytesIO

from future.utils import PY2

from pants.base.deprecated import deprecated_module
from pants.goal.goal import Goal
from pants.ivy.bootstrapper import Bootstrapper
from pants.task.console_task import ConsoleTask
from pants.util.contextutil import temporary_dir
from pants.util.process_handler import subprocess
from pants_test.base_test import BaseTest


deprecated_module('1.12.0.dev0', 'Use pants_test.TaskTestBase instead')


# TODO: Find a better home for this?
def is_exe(name):
  result = subprocess.call(['which', name], stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT)
  return result == 0


def ensure_cached(task_cls, expected_num_artifacts=None):
  """Decorator for a task-executing unit test. Asserts that after running the
  decorated test function, the cache for task_cls contains
  expected_num_artifacts.

  Uses a new temp dir for the artifact cache, and uses a glob based on the
  task's synthesized subtype to find the cache directories within the new temp
Ejemplo n.º 23
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.codegen.antlr.java.antlr_java_gen import AntlrJavaGen
from pants.base.deprecated import deprecated_module


deprecated_module('1.5.0.dev0', 'Use pants.backend.codegen.antlr.java instead')

AntlrGen = AntlrJavaGen
Ejemplo n.º 24
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.target import AbstractTarget, Target

deprecated_module('0.0.53',
                  hint_message='Use pants.build_graph.target instead.')

AbstractTarget = AbstractTarget
Target = Target
Ejemplo n.º 25
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.backend.codegen.antlr.java.java_antlr_library import JavaAntlrLibrary
from pants.base.deprecated import deprecated_module

deprecated_module('1.5.0.dev0', 'Use pants.backend.codegen.antlr.java instead')

JavaAntlrLibrary = JavaAntlrLibrary
Ejemplo n.º 26
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.repl_task_mixin import ReplTaskMixin

deprecated_module(
    '0.0.64',
    hint_message='pants.backend.core.tasks.repl_task_mixin has moved to '
    'pants.task.repl_task_mixin. Replace deps on '
    'src/python/pants/backend/core/tasks:repl_task_mixin and on with a '
    'dep on src/python/pants/task and change imports accordingly.')

ReplTaskMixin = ReplTaskMixin
Ejemplo n.º 27
0
import glob
import os
from contextlib import closing, contextmanager
from io import BytesIO

from future.utils import PY2

from pants.base.deprecated import deprecated_module
from pants.goal.goal import Goal
from pants.ivy.bootstrapper import Bootstrapper
from pants.task.console_task import ConsoleTask
from pants.util.contextutil import temporary_dir
from pants.util.process_handler import subprocess
from pants_test.base_test import BaseTest

deprecated_module('1.10.0.dev0', 'Use pants_test.TaskTestBase instead')


# TODO: Find a better home for this?
def is_exe(name):
    result = subprocess.call(['which', name],
                             stdout=open(os.devnull, 'w'),
                             stderr=subprocess.STDOUT)
    return result == 0


def ensure_cached(task_cls, expected_num_artifacts=None):
    """Decorator for a task-executing unit test. Asserts that after running the
  decorated test function, the cache for task_cls contains
  expected_num_artifacts.
Ejemplo n.º 28
0
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.task_registrar import TaskRegistrar as task

from pants.contrib.android.targets.android_binary import AndroidBinary
from pants.contrib.android.targets.android_dependency import AndroidDependency
from pants.contrib.android.targets.android_library import AndroidLibrary
from pants.contrib.android.targets.android_resources import AndroidResources
from pants.contrib.android.tasks.aapt_builder import AaptBuilder
from pants.contrib.android.tasks.aapt_gen import AaptGen
from pants.contrib.android.tasks.dx_compile import DxCompile
from pants.contrib.android.tasks.sign_apk import SignApkTask
from pants.contrib.android.tasks.unpack_libraries import UnpackLibraries
from pants.contrib.android.tasks.zipalign import Zipalign

deprecated_module(
    '1.7.0.dev0',
    'Android backend is going away, unless you want to update and maintain it!'
)


def build_file_aliases():
    return BuildFileAliases(
        targets={
            'android_binary': AndroidBinary,
            'android_dependency': AndroidDependency,
            'android_library': AndroidLibrary,
            'android_resources': AndroidResources,
        })


def register_goals():
    task(name='unpack-libs', action=UnpackLibraries).install('unpack-jars')
Ejemplo n.º 29
0
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.java.jar.exclude import Exclude


deprecated_module('1.5.0dev0', 'Use pants.backend.jvm.exclude instead')

Exclude = Exclude
Ejemplo n.º 30
0
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.pants_run_integration_test import PantsJoinHandle as PantsJoinHandle  # noqa
from pants.testutil.pants_run_integration_test import PantsResult as PantsResult  # noqa
from pants.testutil.pants_run_integration_test import (
    PantsRunIntegrationTest as PantsRunIntegrationTest, )  # noqa
from pants.testutil.pants_run_integration_test import ensure_cached as ensure_cached  # noqa
from pants.testutil.pants_run_integration_test import ensure_daemon as ensure_daemon  # noqa
from pants.testutil.pants_run_integration_test import ensure_resolver as ensure_resolver  # noqa
from pants.testutil.pants_run_integration_test import read_pantsd_log as read_pantsd_log  # noqa
from pants.testutil.pants_run_integration_test import render_logs as render_logs  # noqa

deprecated_module(
    removal_version="1.25.0.dev0",
    hint_message="Import pants.testutil.pants_run_integration_test instead.")
Ejemplo n.º 31
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.backend.codegen.ragel.java.ragel_gen import RagelGen
from pants.base.deprecated import deprecated_module

deprecated_module('1.5.0dev0', 'Use pants.backend.codegen.ragel.java instead')

RagelGen = RagelGen
Ejemplo n.º 32
0
    with_statement,
)

from pants.base.deprecated import deprecated_module
from pants.source.wrapped_globs import (
    FilesetRelPathWrapper,
    FilesetWithSpec,
    Globs,
    RGlobs,
    ZGlobs,
    globs_matches,
    matches_filespec,
)


deprecated_module(
    "0.0.66",
    hint_message="pants.backend.core.wrapped_globs has moved to pants.sources.wrapped_globs. "
    "Replace deps on src/python/pants/backend/core:wrapped_globs with a dep on "
    "src/python/pants/source and change imports accordingly.",
)


globs_matches = globs_matches
matches_filespec = matches_filespec
FilesetWithSpec = FilesetWithSpec
FilesetRelPathWrapper = FilesetRelPathWrapper
Globs = Globs
RGlobs = RGlobs
ZGlobs = ZGlobs
Ejemplo n.º 33
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.repl_task_mixin import ReplTaskMixin


deprecated_module('0.0.64',
                  hint_message='pants.backend.core.tasks.repl_task_mixin has moved to '
                               'pants.task.repl_task_mixin. Replace deps on '
                               'src/python/pants/backend/core/tasks:repl_task_mixin and on with a '
                               'dep on src/python/pants/task and change imports accordingly.')


ReplTaskMixin = ReplTaskMixin
Ejemplo n.º 34
0
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.console_rule_test_base import ConsoleRuleTestBase as ConsoleRuleTestBase  # noqa

deprecated_module(
    removal_version="1.25.0.dev0",
    hint_message="Import pants.testutil.console_rule_test_base instead.")
Ejemplo n.º 35
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.from_target import FromTarget


deprecated_module('0.0.66',
                  hint_message='pants.backend.core.from_target has moved to '
                               'pants.build_graph.from_target. Replace deps on '
                               'src/python/pants/backend/core with a dep on '
                               'src/python/pants/build_graph and change imports accordingly.')


FromTarget = FromTarget
Ejemplo n.º 36
0
Archivo: doc.py Proyecto: moshez/pants
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.backend.docgen.targets.doc import Page, Wiki, WikiArtifact
from pants.base.deprecated import deprecated_module

deprecated_module(
    '0.0.66',
    hint_message='pants.backend.core.targets.doc has moved to '
    'pants.backend.docgen.targets.doc. Replace deps on '
    'src/python/pants/backend/core/targets:all or '
    'src/python/pants/backend/core/targets:common with a dep on '
    'src/python/pants/backend/docgen/targets and change imports accordingly.')

Page = Page
Wiki = Wiki
WikiArtifact = WikiArtifact
Ejemplo n.º 37
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.simple_codegen_task import SimpleCodegenTask

deprecated_module('1.5.0dev0', 'Use pants.task.simple_codegen_task instead')

SimpleCodegenTask = SimpleCodegenTask
Ejemplo n.º 38
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.target import AbstractTarget, Target


deprecated_module('0.0.53', hint_message='Use pants.build_graph.target instead.')

AbstractTarget = AbstractTarget
Target = Target
Ejemplo n.º 39
0
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.backend.python.tasks import PythonRepl
from pants.base.deprecated import deprecated_module

deprecated_module('1.7.0.dev0', 'Use pants.backend.python.tasks instead')

PythonRepl = PythonRepl
Ejemplo n.º 40
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.scm_publish_mixin import Namedver, ScmPublishMixin, Semver, Version

deprecated_module(
    '0.0.66',
    hint_message='pants.backend.core.tasks.scm_publish has moved to '
    'pants.task.scm_publish_mixin. Replace deps on '
    'src/python/pants/backend/core/tasks:scm_publish and on '
    'src/python/pants/backend/core/tasks:all with a dep on '
    'src/python/pants/task and change imports accordingly.')

Version = Version
Namedver = Namedver
Semver = Semver
ScmPublishMixin = ScmPublishMixin
Ejemplo n.º 41
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.source.wrapped_globs import (FilesetRelPathWrapper, FilesetWithSpec,
                                        Globs, RGlobs, ZGlobs, globs_matches,
                                        matches_filespec)

deprecated_module(
    '0.0.66',
    hint_message=
    'pants.backend.core.wrapped_globs has moved to pants.sources.wrapped_globs. '
    'Replace deps on src/python/pants/backend/core:wrapped_globs with a dep on '
    'src/python/pants/source and change imports accordingly.')

globs_matches = globs_matches
matches_filespec = matches_filespec
FilesetWithSpec = FilesetWithSpec
FilesetRelPathWrapper = FilesetRelPathWrapper
Globs = Globs
RGlobs = RGlobs
ZGlobs = ZGlobs
Ejemplo n.º 42
0
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.python.tasks import SetupPy
from pants.base.deprecated import deprecated_module


deprecated_module('1.7.0.dev0', 'Use pants.backend.python.tasks instead')

SetupPy = SetupPy
Ejemplo n.º 43
0
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.build_graph.address import Address, Addresses, BuildFileAddress, parse_spec


deprecated_module('0.0.55', hint_message='Use pants.build_graph.address instead.')

Address = Address
Addresses = Addresses
BuildFileAddress = BuildFileAddress
parse_spec = parse_spec
Ejemplo n.º 44
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.backend.codegen.thrift.python.python_thrift_library import PythonThriftLibrary
from pants.base.deprecated import deprecated_module

deprecated_module('1.5.0dev0',
                  'Use pants.backend.codegen.thrift.python instead')

PythonThriftLibrary = PythonThriftLibrary
Ejemplo n.º 45
0
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.engine.base_engine_test import EngineTestBase as EngineTestBase  # noqa

deprecated_module(
    removal_version="1.25.0.dev0",
    hint_message="Import pants.testutil.engine.base_engine_test instead.")
Ejemplo n.º 46
0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.task import QuietTaskMixin, Task, TaskBase

deprecated_module(
    '0.0.64',
    hint_message='pants.backend.core.tasks.task has moved to pants.task.task. '
    'Replace deps on src/python/pants/backend/core/tasks:task and on '
    'src/python/pants/backend/core/tasks:common with a dep on '
    'src/python/pants/task and change imports accordingly.')

TaskBase = TaskBase
Task = Task
QuietTaskMixin = QuietTaskMixin
Ejemplo n.º 47
0
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.backend.codegen.thrift.java.apache_thrift_gen import ApacheThriftGen


deprecated_module('1.5.0', 'Use pants.backend.codegen.thrift.java instead')

ApacheThriftGen = ApacheThriftGen
Ejemplo n.º 48
0
from pants.build_graph.build_file_address_mapper import BuildFileAddressMapper
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.build_graph.build_file_parser import BuildFileParser
from pants.build_graph.mutable_build_graph import MutableBuildGraph
from pants.build_graph.target import Target
from pants.init.util import clean_global_runtime_state
from pants.option.options_bootstrapper import OptionsBootstrapper
from pants.option.scope import GLOBAL_SCOPE
from pants.source.source_root import SourceRootConfig
from pants.subsystem.subsystem import Subsystem
from pants.task.goal_options_mixin import GoalOptionsMixin
from pants.util.dirutil import safe_mkdir, safe_open, safe_rmtree
from pants_test.base.context_utils import create_context_from_options
from pants_test.option.util.fakes import create_options_for_optionables

deprecated_module('1.10.0.dev0', 'Use pants_test.test_base instead')


class TestGenerator(object):
    """A mixin that facilitates test generation at runtime."""
    @classmethod
    def generate_tests(cls):
        """Generate tests for a given class.

    This should be called against the composing class in it's defining module, e.g.

      class ThingTest(TestGenerator):
        ...

      ThingTest.generate_tests()
Ejemplo n.º 49
0
Archivo: doc.py Proyecto: moshez/pants
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.backend.docgen.targets.doc import Page, Wiki, WikiArtifact
from pants.base.deprecated import deprecated_module


deprecated_module('0.0.66',
                  hint_message='pants.backend.core.targets.doc has moved to '
                               'pants.backend.docgen.targets.doc. Replace deps on '
                               'src/python/pants/backend/core/targets:all or '
                               'src/python/pants/backend/core/targets:common with a dep on '
                               'src/python/pants/backend/docgen/targets and change imports accordingly.')


Page = Page
Wiki = Wiki
WikiArtifact = WikiArtifact
Ejemplo n.º 50
0
from pants.backend.jvm.tasks.ivy_task_mixin import IvyTaskMixin
from pants.backend.jvm.tasks.nailgun_task import NailgunTask
from pants.backend.python.targets.python_tests import PythonTests
from pants.base.build_environment import get_buildroot
from pants.base.build_file import BuildFile
from pants.base.deprecated import deprecated_module
from pants.base.exceptions import TaskError
from pants.base.project_tree_factory import get_project_tree
from pants.build_graph.address import BuildFileAddress
from pants.build_graph.resources import Resources
from pants.util import desktop
from pants.util.dirutil import safe_mkdir, safe_walk


deprecated_module('1.7.0.dev0',
                  'IDE project generation functionality will be removed entirely.  Use the'
                  'Pants IntelliJ plugin, or discuss alternative solutions with the Pants team.')


logger = logging.getLogger(__name__)


# We use custom checks for scala and java targets here for 2 reasons:
# 1.) jvm_binary could have either a scala or java source file attached so we can't do a pure
#     target type test
# 2.) the target may be under development in which case it may not have sources yet - its pretty
#     common to write a BUILD and ./pants idea the target inside to start development at which
#     point there are no source files yet - and the developer intents to add them using the ide.
def is_scala(target):
  return (isinstance(target, ScalaLibrary) or
          isinstance(target, JvmTarget) and target.has_sources('.scala'))
Ejemplo n.º 51
0
from pants.testutil.interpreter_selection_utils import PY_2 as PY_2  # noqa
from pants.testutil.interpreter_selection_utils import PY_3 as PY_3  # noqa
from pants.testutil.interpreter_selection_utils import PY_27 as PY_27  # noqa
from pants.testutil.interpreter_selection_utils import PY_36 as PY_36  # noqa
from pants.testutil.interpreter_selection_utils import PY_37 as PY_37  # noqa
from pants.testutil.interpreter_selection_utils import has_python_version as has_python_version  # noqa
from pants.testutil.interpreter_selection_utils import (
    python_interpreter_path as python_interpreter_path, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_all_pythons_present as skip_unless_all_pythons_present,
)  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python3_present as skip_unless_python3_present, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python27_and_python3_present as
    skip_unless_python27_and_python3_present, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python27_and_python36_present as
    skip_unless_python27_and_python36_present, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python27_present as skip_unless_python27_present, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python36_and_python37_present as
    skip_unless_python36_and_python37_present, )  # noqa
from pants.testutil.interpreter_selection_utils import (
    skip_unless_python36_present as skip_unless_python36_present, )  # noqa

deprecated_module(
    removal_version="1.25.0.dev0",
    hint_message="Import pants.testutil.interpreter_selection_utils instead.")
Ejemplo n.º 52
0
"""Deprecated custom Python lints.

Instead, use the V2 backend `pants.backend.python.lint.flake8`.
"""

from pants.base.deprecated import deprecated_module
from pants.goal.task_registrar import TaskRegistrar as task

from pants.contrib.python.checks.tasks.checkstyle.checkstyle import Checkstyle
from pants.contrib.python.checks.tasks.python_eval import PythonEval

deprecated_module(
    removal_version="1.30.0.dev0",
    hint_message=(
        "The `pants.contrib.python.checks` will no longer be maintained as it has been superseded "
        "by more modern and powerful linters. To prepare, remove the "
        "`pantsbuild.pants.contrib.python.checks` plugin from your "
        "`pants.toml` (or `pants.ini`).\n\nIf you used `lint.pythonstyle`, see "
        "https://github.com/pantsbuild/flake8-pantsbuild#migrating-from-lintpythonstyle-to-flake8 "
        "for a guide on how to migrate to the V2 implementation of Flake8, which offers many more "
        "lints and allows you to easily install additional plugins.\n\nIf you used "
        "`lint.python-eval`, we recommend using MyPy by adding `pantsbuild.pants.contrib.mypy` "
        "to your list of `plugins`."
    ),
)


def register_goals():
    task(name="python-eval", action=PythonEval).install("lint")
    task(name="pythonstyle", action=Checkstyle).install("lint")
Ejemplo n.º 53
0
Archivo: task.py Proyecto: jduan/pants
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.task.task import QuietTaskMixin, Task, TaskBase


deprecated_module('0.0.64',
                  hint_message='pants.backend.core.tasks.task has moved to pants.task.task. '
                               'Replace deps on src/python/pants/backend/core/tasks:task and on '
                               'src/python/pants/backend/core/tasks:common with a dep on '
                               'src/python/pants/task and change imports accordingly.')


TaskBase = TaskBase
Task = Task
QuietTaskMixin = QuietTaskMixin
Ejemplo n.º 54
0
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.java.jar.jar_dependency import JarDependency


deprecated_module('1.5.0.dev0', 'Use pants.java.jar instead')

JarDependency = JarDependency
Ejemplo n.º 55
0
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.base.deprecated import deprecated_module
from pants.testutil.jvm.jvm_tool_task_test_base import JvmToolTaskTestBase as JvmToolTaskTestBase  # noqa

deprecated_module(
    removal_version="1.25.0.dev0",
    hint_message="Import pants.testutil.jvm.jvm_tool_task_test_base instead.")
Ejemplo n.º 56
0
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes,
                        print_function, unicode_literals, with_statement)

from pants.base.deprecated import deprecated_module
from pants.java.jar.exclude import Exclude

deprecated_module('1.5.0dev0', 'Use pants.backend.jvm.exclude instead')

Exclude = Exclude