Пример #1
0
def check_release_file():
    if tools.has_source_changes():
        if not tools.has_release():
            print('There are source changes but no RELEASE.rst. Please create '
                  'one to describe your changes.')
            sys.exit(1)
        tools.parse_release_file()
# ([email protected]), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if you need to determine who owns an individual
# contribution.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# END HEADER

from __future__ import division, print_function, absolute_import

import os
import sys

import hypothesistooling as tools

sys.path.append(os.path.dirname(__file__))  # noqa


if __name__ == '__main__':
    if tools.has_source_changes():
        if not tools.has_release():
            print(
                'There are source changes but no RELEASE.rst. Please create '
                'one to describe your changes.'
            )
            sys.exit(1)
        tools.parse_release_file()
# ([email protected]), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if you need to determine who owns an individual
# contribution.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# END HEADER

from __future__ import division, print_function, absolute_import

import os
import sys

import hypothesistooling as tools

sys.path.append(os.path.dirname(__file__))  # noqa


if __name__ == '__main__':
    if tools.has_source_changes():
        if not tools.has_release():
            print(
                'There are source changes but no RELEASE.rst. Please create '
                'one to describe your changes.'
            )
            sys.exit(1)
        tools.parse_release_file()
sys.path.append(os.path.dirname(__file__))  # noqa


def version_string(nums):
    return '.'.join(str(s) for s in nums)


def version_nums(string):
    string = string.strip().split()[0]
    return tuple(int(n) for n in string.split('.'))


if __name__ == '__main__':

    if not tools.has_source_changes():
        print('No source changes found')
        sys.exit(0)

    found_problem = False

    now = datetime.utcnow()
    hour = timedelta(hours=1)
    acceptable_lines = sorted(set(
        '{} - {}'.format(tools.__version__, d.strftime('%Y-%m-%d'))
        for d in (now, now + hour, now - hour)
    ))

    pattern = r'\n\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}\n'
    all_versions = list(map(str.strip, re.findall(pattern, tools.changelog())))
    v_nums = [version_nums(v) for v in all_versions]
Пример #5
0
# Most of this work is copyright (C) 2013-2017 David R. MacIver
# ([email protected]), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if you need to determine who owns an individual
# contribution.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# END HEADER

from __future__ import division, print_function, absolute_import

import os
import sys

import hypothesistooling as tools

sys.path.append(os.path.dirname(__file__))  # noqa

if __name__ == '__main__':
    if tools.__version__ in tools.tags():
        if tools.has_source_changes(tools.__version__):
            print('Has code changes from existing released version %s' %
                  (tools.__version__, ))
            print('This means you should update src/hypothesis/version.py '
                  "to a new version before merging to master. Don't forget "
                  'to update the changelog too!')
            sys.exit(1)
Пример #6
0
# consult the git log if you need to determine who owns an individual
# contribution.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# END HEADER

from __future__ import division, print_function, absolute_import

import os
import sys

import hypothesistooling as tools

sys.path.append(os.path.dirname(__file__))  # noqa

DO_RELEASE_CHECK = os.environ.get('TRAVIS_BRANCH', 'master') == 'master'

if __name__ == '__main__':
    if DO_RELEASE_CHECK and tools.has_source_changes():
        if not tools.has_release():
            print('There are source changes but no RELEASE.rst. Please create '
                  'one to describe your changes.')
            sys.exit(1)
        tools.parse_release_file()
    else:
        print('Skipping release check, because this is not the master branch '
              'or the pull request is not targeting the master branch.')