summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/internal/convert_readme.py2
-rwxr-xr-xscripts/internal/git_pre_commit.py16
-rwxr-xr-xscripts/internal/print_announce.py10
-rwxr-xr-xscripts/internal/tidelift.py43
-rwxr-xr-xscripts/internal/winmake.py10
5 files changed, 20 insertions, 61 deletions
diff --git a/scripts/internal/convert_readme.py b/scripts/internal/convert_readme.py
index cca7dcb0..81f7bdb6 100755
--- a/scripts/internal/convert_readme.py
+++ b/scripts/internal/convert_readme.py
@@ -36,7 +36,7 @@ Sponsors
`Add your logo <https://github.com/sponsors/giampaolo>`__.
-Example usages"""
+Example usages""" # noqa
def main():
diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py
index c6f223bb..46b3bc53 100755
--- a/scripts/internal/git_pre_commit.py
+++ b/scripts/internal/git_pre_commit.py
@@ -109,14 +109,14 @@ def main():
print("%s:%s %r" % (path, lineno, line))
return exit("space at end of line")
line = line.rstrip()
- # pdb
- if "pdb.set_trace" in line:
- print("%s:%s %s" % (path, lineno, line))
- return exit("you forgot a pdb in your python code")
- # bare except clause
- if "except:" in line and not line.endswith("# NOQA"):
- print("%s:%s %s" % (path, lineno, line))
- return exit("bare except clause")
+ # # pdb (now provided by flake8-debugger plugin)
+ # if "pdb.set_trace" in line:
+ # print("%s:%s %s" % (path, lineno, line))
+ # return exit("you forgot a pdb in your python code")
+ # # bare except clause (now provided by flake8-blind-except plugin)
+ # if "except:" in line and not line.endswith("# NOQA"):
+ # print("%s:%s %s" % (path, lineno, line))
+ # return exit("bare except clause")
# Python linters
if py_files:
diff --git a/scripts/internal/print_announce.py b/scripts/internal/print_announce.py
index c9948c1d..c2113f36 100755
--- a/scripts/internal/print_announce.py
+++ b/scripts/internal/print_announce.py
@@ -47,7 +47,7 @@ line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, \
nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It \
currently supports Linux, Windows, macOS, Sun Solaris, FreeBSD, OpenBSD, \
NetBSD and AIX, both 32-bit and 64-bit architectures. Supported Python \
-versions are 2.6, 2.7 and 3.4+. PyPy is also known to work.
+versions are 2.7 and 3.4+. PyPy is also known to work.
What's new
==========
@@ -83,7 +83,7 @@ def get_changes():
block = []
# eliminate the part preceding the first block
- for i, line in enumerate(lines):
+ for line in lines:
line = lines.pop(0)
if line.startswith('===='):
break
@@ -92,10 +92,8 @@ def get_changes():
for i, line in enumerate(lines):
line = lines.pop(0)
line = line.rstrip()
- if re.match(r"^- \d+_: ", line):
- num, _, rest = line.partition(': ')
- num = ''.join([x for x in num if x.isdigit()])
- line = "- #%s: %s" % (num, rest)
+ if re.match(r"^- \d+_", line):
+ line = re.sub(r"^- (\d+)_", r"- #\1", line)
if line.startswith('===='):
break
diff --git a/scripts/internal/tidelift.py b/scripts/internal/tidelift.py
deleted file mode 100755
index 9470fc85..00000000
--- a/scripts/internal/tidelift.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-Update news entry of Tidelift with latest HISTORY.rst section.
-Put your Tidelift API token in a file first:
-~/.tidelift.token
-"""
-
-from __future__ import print_function
-
-import os
-
-import requests
-
-import psutil
-from psutil.tests import import_module_by_path
-
-
-def upload_relnotes(package, version, text, token):
- url = "https://api.tidelift.com/external-api/" + \
- "lifting/pypi/%s/release-notes/%s" % (package, version)
- res = requests.put(
- url=url,
- data=text.encode('utf8'),
- headers={"Authorization": "Bearer: %s" % token})
- print(version, res.status_code, res.text)
- res.raise_for_status()
-
-
-def main():
- here = os.path.abspath(os.path.dirname(__file__))
- path = os.path.join(here, "print_announce.py")
- get_changes = import_module_by_path(path).get_changes
- with open(os.path.expanduser("~/.tidelift.token")) as f:
- token = f.read().strip()
- upload_relnotes('psutil', psutil.__version__, get_changes(), token)
-
-
-if __name__ == "__main__":
- main()
diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py
index 6c482975..bb880051 100755
--- a/scripts/internal/winmake.py
+++ b/scripts/internal/winmake.py
@@ -41,17 +41,21 @@ PYPY = '__pypy__' in sys.builtin_module_names
DEPS = [
"coverage",
"flake8",
+ "flake8-blind-except",
+ "flake8-debugger",
+ "flake8-print",
"nose",
"pdbpp",
"pip",
"pyperf",
"pyreadline",
+ "requests",
"setuptools",
"wheel",
- "requests"
]
-if sys.version_info[:2] <= (2, 7):
- DEPS.append('unittest2')
+
+if sys.version_info[:2] >= (3, 5):
+ DEPS.append('flake8-bugbear')
if sys.version_info[:2] <= (2, 7):
DEPS.append('mock')
if sys.version_info[:2] <= (3, 2):