Merge branch 'devel'

This commit is contained in:
Laszlo Nagy
2021-05-11 23:21:55 +10:00
11 changed files with 130 additions and 241 deletions

56
.github/workflows/python-package.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Python package
on:
push:
branches: [ master, devel ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
exclude:
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.9
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Clang (on Windows)
if: runner.os == 'Windows'
run: |
choco install llvm
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 nose lit
python -m pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with nose
run: |
nosetests tests/unit --verbose
- name: Test with lit
if: runner.os != 'Windows'
run: |
lit -v tests
- name: Test with lit (on Windows)
if: runner.os == 'Windows'
run: |
pip install . --use-feature=in-tree-build
lit -DUSE_INSTALLED=true -v tests

28
.github/workflows/python-publish.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

View File

@@ -1,101 +0,0 @@
language: python
matrix:
include:
- os: linux
dist: bionic
sudo: false
python: 2.7
env:
- TRAVIS_CLANG=clang-8
- os: linux
dist: bionic
sudo: false
python: 3.5
env:
- TRAVIS_CLANG=clang-8
- os: linux
dist: bionic
sudo: false
python: 3.6
env:
- TRAVIS_CLANG=clang-8
- TYPECHECK=true
- os: linux
dist: bionic
sudo: false
python: 3.7
env:
- TRAVIS_CLANG=clang-8
- TYPECHECK=true
- os: linux
dist: bionic
sudo: false
python: 3.8
env:
- TRAVIS_CLANG=clang-8
- TYPECHECK=true
- os: osx
osx_image: xcode8
language: generic
addons:
apt:
sources:
- llvm-toolchain-bionic-8
- ubuntu-toolchain-r-test
packages:
- clang-8
- cmake
- scons
- qt4-qmake
before_install:
- uname
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
csrutil status || true;
fi
install:
- pip --version
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install lit pycodestyle flake8 pylint nose coverage coveralls
- if [[ "$TYPECHECK" ]]; then
pip install mypy;
fi
script:
- pycodestyle --show-source --show-pep8 libscanbuild
- flake8 --verbose libscanbuild
- if [[ "$TYPECHECK" ]]; then
mypy libscanbuild;
fi
- pylint libscanbuild || true
- nosetests tests/unit --with-coverage --cover-branches
- lit -v tests
- pip install .
after_success:
- find . -type f -name ".coverage.*" | xargs coverage combine
- coverage report
- coveralls
before_deploy:
- python setup.py sdist
deploy:
provider: pypi
user: "rizsotto"
password:
secure: "ModXQEmzuckPZ3KhHR8sU7Or2ivqfifY15/fTFZ5h3zhVfeqFjIdjcqb9lZSM3tezCKgsPv6jCC5T92tY/Ul78tUOuA71rWlqkiacxrMOF3AprXr7QJ/+ssY+AmRS+Mb1e/JgeRra+2AUIwZfLPK4sV8mvbvRUebw9M/xGf9eIc="
on:
tags: true
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/c3b71470714f6eaa03bc
on_success: change
on_failure: always
on_start: never

View File

@@ -1,12 +1,3 @@
.. image:: https://travis-ci.org/rizsotto/scan-build.svg?branch=master
:target: https://travis-ci.org/rizsotto/scan-build
.. image:: https://ci.appveyor.com/api/projects/status/k5fi1xy90xieqxir/branch/master?svg=true
:target: https://ci.appveyor.com/project/rizsotto/scan-build/branch/master
.. image:: https://coveralls.io/repos/github/rizsotto/scan-build/badge.svg?branch=master
:target: https://coveralls.io/github/rizsotto/scan-build?branch=master
.. image:: https://img.shields.io/pypi/v/scan-build.svg
:target: https://pypi.python.org/pypi/scan-build
@@ -53,7 +44,7 @@ Prerequisites
-------------
1. **clang compiler**, to compile the sources and have the static analyzer.
2. **python** interpreter (version 2.7, 3.4, 3.5, 3.6, 3.7).
2. **python** interpreter (version 3.6, 3.7, 3.8, 3.9).
How to use

View File

@@ -1,76 +0,0 @@
version: 2.0.{build}
build:
verbosity: detailed
environment:
matrix:
# Pre-installed Python versions <http://www.appveyor.com/docs/installed-software#python>
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python37-x64"
install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Add LLVM to PATH <https://www.appveyor.com/docs/build-environment/#llvm>
- "SET PATH=C:\\Program Files\\LLVM\\bin;%PATH%"
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# Add Qt5 to PATH <https://www.appveyor.com/docs/build-environment/#qt>
- "SET PATH=C:\\Qt\\5.8\\mingw53_32\\bin;%PATH%"
# Add the related MinGW (32 bit environment too)
- "SET PATH=C:\\MinGW\\bin;%PATH%"
# Check Clang version
- "clang.exe --version"
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"
# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "pip install -r requirements.txt"
- "pip install pycodestyle lit"
build_script:
# Build the compiled extension
- "pip install ."
test_script:
# Run the project tests
- "lit -DUSE_INSTALLED=true -v tests"
after_test:
# If tests are successful, create binary packages for the project.
- "python setup.py bdist_wininst"
- ps: "ls dist"
artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: dist\*

View File

@@ -399,20 +399,21 @@ def parse_bug_plist(filename):
# type: (str) -> Generator[Bug, None, None]
""" Returns the generator of bugs from a single .plist file. """
content = plistlib.readPlist(filename)
files = content.get('files', [])
for bug in content.get('diagnostics', []):
if len(files) <= int(bug['location']['file']):
logging.warning('Parsing bug from "%s" failed', filename)
continue
with open(filename, 'rb') as handle:
content = plistlib.load(handle)
files = content.get('files', [])
for bug in content.get('diagnostics', []):
if len(files) <= int(bug['location']['file']):
logging.warning('Parsing bug from "%s" failed', filename)
continue
yield Bug(filename, {
'bug_type': bug['type'],
'bug_category': bug['category'],
'bug_line': bug['location']['line'],
'bug_path_length': bug['location']['col'],
'bug_file': files[int(bug['location']['file'])]
})
yield Bug(filename, {
'bug_type': bug['type'],
'bug_category': bug['category'],
'bug_line': bug['location']['line'],
'bug_path_length': bug['location']['col'],
'bug_file': files[int(bug['location']['file'])]
})
def parse_bug_html(filename):

View File

@@ -35,13 +35,11 @@ setup(
"Environment :: Console", "Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Intended Audience :: Developers", "Programming Language :: C",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Compilers",
"Topic :: Software Development :: Quality Assurance"
])

View File

@@ -17,9 +17,6 @@ config.environment['test_input_dir'] = os.path.join(this_dir, 'Input')
config.environment['CC'] = 'clang'
config.environment['CXX'] = 'clang++'
# this hack is needed to run the right compiler on travis-ci
clang=os.environ.get('TRAVIS_CLANG', 'clang')
ab = 'analyze-build'
sb = 'scan-build'
ib = 'intercept-build'
@@ -33,28 +30,28 @@ if lit_config.params.get('USE_INSTALLED') is None:
config.environment['PATH'] = os.pathsep.join([bin_dir, os.environ['PATH']])
config.environment['PYTHONPATH'] = project_dir
# run with coverage if the tool is available
if 'coverage' in config.available_features:
rc_file=os.path.join(project_dir, '.coveragerc')
config.environment['COVERAGE_PROCESS_START'] = rc_file
# run with coverage if the tool is available
if 'coverage' in config.available_features:
rc_file=os.path.join(project_dir, '.coveragerc')
config.environment['COVERAGE_PROCESS_START'] = rc_file
coverage = 'coverage run --rcfile={rc}'.format(rc=rc_file)
ab = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'analyze-build'))
sb = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'scan-build'))
ib = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'intercept-build'))
coverage = 'coverage run --rcfile={rc}'.format(rc=rc_file)
ab = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'analyze-build'))
sb = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'scan-build'))
ib = '{coverage} {path}'.format(
coverage=coverage,
path=os.path.join(bin_dir, 'intercept-build'))
config.substitutions.append(
('%{analyze-build}',
'{cmd} --use-analyzer={clang} -vvvv'.format(cmd=ab, clang=clang)))
'{cmd} -vvvv'.format(cmd=ab)))
config.substitutions.append(
('%{scan-build}',
'{cmd} --use-analyzer={clang} -vvvv'.format(cmd=sb, clang=clang)))
'{cmd} -vvvv'.format(cmd=sb)))
config.substitutions.append(
('%{intercept-build}',
'{cmd} -vvvv'.format(cmd=ib)))
@@ -64,3 +61,9 @@ config.substitutions.append(
config.substitutions.append(
('%{expect}',
'{python} {expect}'.format(python=sys.executable, expect=os.path.join(tool_dir, 'expect.py'))))
print("lit.local.cfg config")
print(config.substitutions)
print(config.environment)
print(config.available_features)

View File

@@ -75,4 +75,10 @@ else:
sys.path.append(project_dir)
from libscanbuild.intercept import is_preload_disabled
if not is_preload_disabled(sys.platform):
config.available_features.add('preload')
config.available_features.add('preload')
print("lit.cfg config")
print(config.substitutions)
print(config.environment)
print(config.available_features)

View File

@@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
import os.path
import lit.util
# test_source_root: The root path where tests are located.
this_dir = os.path.dirname(__file__)
parent_dir = os.path.dirname(this_dir)
project_dir = os.path.dirname(parent_dir)
config.environment['PYTHONPATH'] = project_dir

View File

@@ -1 +0,0 @@
# RUN: %{python} -m unittest discover -v