Minor code cleanup

- Reducing linter errors
- Removing old Python 2-only code (__future__ print)
This commit is contained in:
Jacob Alexander
2020-06-08 23:51:07 -07:00
parent 255119b838
commit 49fd4854d8
22 changed files with 16 additions and 101 deletions

View File

@@ -1,9 +0,0 @@
"""utilities for building pyzmq.
Largely adapted from h5py
"""
# flake8: noqa F401 F403
from .msg import *
from .bundle import *
from .build import *

View File

@@ -17,7 +17,6 @@ import shutil
import tarfile
from urllib.request import urlopen
from .msg import info
pjoin = os.path.join
@@ -55,9 +54,9 @@ def fetch_archive(savedir, url, fname, force=False):
"""download an archive to a specific location"""
dest = pjoin(savedir, fname)
if os.path.exists(dest) and not force:
info("already have %s" % fname)
print("already have %s" % fname)
return dest
info("fetching %s into %s" % (url, savedir))
print("fetching %s into %s" % (url, savedir))
if not os.path.exists(savedir):
os.makedirs(savedir)
req = urlopen(url)
@@ -79,7 +78,7 @@ def fetch_libcapnp(savedir, url=None):
is_preconfigured = True
dest = pjoin(savedir, 'capnproto-c++')
if os.path.exists(dest):
info("already have %s" % dest)
print("already have %s" % dest)
return
fname = fetch_archive(savedir, url, libcapnp_name)
tf = tarfile.open(fname)

View File

@@ -1,48 +0,0 @@
"""logging"""
# Copyright (c) PyZMQ Developers.
# Distributed under the terms of the Modified BSD License.
from __future__ import division
import os
import sys
import logging
#
# Logging (adapted from h5py: http://h5py.googlecode.com)
#
logger = logging.getLogger()
if os.environ.get('DEBUG'):
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stderr))
def debug(msg):
"""Debug"""
logger.debug(msg)
def info(msg):
"""Info"""
logger.info(msg)
def fatal(msg, code=1):
"""Fatal"""
logger.error("Fatal: %s", msg)
exit(code)
def warn(msg):
"""Warning"""
logger.error("Warning: %s", msg)
def line(c='*', width=48):
"""Horizontal rule"""
print(c * (width // len(c)))