Skip to content

Commit 6ee2107

Browse files
committed
Squashed commit of the following:
commit 95965b8 Merge: a88582d f2f0ac7 Author: Chris Billington <chrisjbillington@gmail.com> Date: Thu Mar 17 08:02:09 2022 +1100 Merge pull request #86 from dihm/replace_distutils Replace distutils commit f2f0ac7 Author: David Meyer <dihm.meyer@gmail.com> Date: Wed Mar 16 09:43:51 2022 -0400 Replace `distutils.log` with basic `logging` in `setup.py`. commit b6b7823 Author: David Meyer <dihm.meyer@gmail.com> Date: Wed Mar 16 09:04:46 2022 -0400 Replace `distutils.sysconfig` with stdlib `sysconfig` in `modulewatcher`. commit 9840228 Author: David Meyer <dihm.meyer@gmail.com> Date: Wed Mar 16 09:04:10 2022 -0400 Replace `distutils.version.LooseVersion` with `packaging.version.Version` in `ls_zprocess`. commit a88582d Merge: 66c68ab 75a7df6 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Mar 3 09:28:57 2022 -0500 Merge pull request #84 from dihm/generic_freq_conv Add generic frequency conversion class commit 75a7df6 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 12:27:17 2022 -0500 Add generic frequency conversion class that goes between standard SI prefixes from a base of Hz. commit 66c68ab Merge: 7a3d58c 27501a3 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 10:47:36 2022 -0500 Merge pull request #83 from dihm/fix_docs_build Prevent starting a zlock server when importing `h5_lock` on RTD. commit 27501a3 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 10:34:22 2022 -0500 Prevent starting a zlock server when importing `h5_lock` on RTD. commit 7a3d58c Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 2 17:24:26 2022 -0500 Pin `mistune` to fix doc builds on RTD. commit 36c3c6a Author: chrisjbillington <chrisjbillington@gmail.com> Date: Fri Jan 7 17:23:48 2022 +1100 Ensure only ints passed to QFrame.move in splash Otherwise this is a TypeError in the latest PyQt5. commit f4da12e Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Nov 30 13:00:27 2021 -0500 Triggering build of release branch by undoing unnecessary pin change for pyqtgraph. commit a79d0e4 Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Nov 30 11:20:27 2021 -0500 Update setup.cfg in preparation for release. commit 811b43d Merge: b8726ad a3be0db Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Nov 10 17:07:51 2021 -0500 Merge pull request #81 from chrisjbillington/py36-path-bug Fix bug on Python3.6 commit b8726ad Merge: d309a5f c4dd2a8 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Nov 10 17:06:47 2021 -0500 Merge pull request #78 from zakv/setup-logging-jupyter Make setup_logging() more Jupyter-friendly. commit d309a5f Merge: d5dfea7 12db878 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Nov 10 17:06:02 2021 -0500 Merge pull request #82 from dihm/zlog_port_profile Add default zlog port to default profile configuration file. commit c4dd2a8 Author: Zak V <zakven@mit.edu> Date: Tue Nov 9 20:12:19 2021 -0500 Removed duplicate call to sys.stdout.fileno() in setup_logging.setup_logging(). Probably best practice to call it just once rather than calling it first to check if it raises an error then again later to actually use the value it returns. commit 2e38107 Author: Zak V <zakven@mit.edu> Date: Tue Nov 9 20:04:37 2021 -0500 Restructured try/except block in setup_logging.setup_logging() to avoid catching any UnsupportedOperation errors thrown by code other than sys.stdout.fileno(). commit 97e70c7 Author: Zak V <zakven@mit.edu> Date: Tue Nov 9 19:56:07 2021 -0500 Added warning message when setup_logging.setup_logging() cannot send output to stdout and stderr. commit b711923 Author: Zak V <zakven@mit.edu> Date: Mon Jun 7 17:48:41 2021 -0400 setup_logging.py is now more Jupyter-friendly. commit d5dfea7 Merge: 9b76dcb b149e19 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Nov 10 08:54:21 2021 -0500 Merge pull request #74 from zakv/unitconversions-import-bugfix Fixed bug in unitconversions._All._import_all() commit 12db878 Author: David Meyer <dihm@users.noreply.github.com> Date: Mon Nov 8 10:20:28 2021 -0500 Add default zlog port to default profile configuration file. commit 9b76dcb Merge: e13c992 e5cf3fb Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Oct 22 17:53:17 2021 -0400 Merge pull request #80 from dihm/default_labconfig_docs Add default labconfig file to docs commit a3be0db Author: chrisjbillington <chrisjbillington@gmail.com> Date: Tue Sep 21 13:45:13 2021 +1000 Fix bug on Python3.6, where Path object not able to be treated as a string in ConfigParser. commit e5cf3fb Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Aug 31 15:29:45 2021 -0400 Create a doc page that displays the current default labconfig.ini file, for easy reference. commit e13c992 Merge: e74472c 461dc9f Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Jul 16 15:12:37 2021 -0400 Merge pull request #79 from dihm/labscript_utils-docs Update docs to match autogenerating templates used in other modules of labscript. commit 461dc9f Author: David Meyer <dihm.meyer@gmail.com> Date: Thu Jul 15 10:26:41 2021 -0400 Add docstring coverage test to build. commit f90a4cc Author: David Meyer <dihm.meyer@gmail.com> Date: Thu Jul 15 10:26:26 2021 -0400 Update sphinx version. commit e45107d Author: David Meyer <dihm.meyer@gmail.com> Date: Mon Jul 12 12:57:18 2021 -0400 Converting docs build to fully automated version based on recursive autosummary calls. This more closely resembles how docs are built in the other modules, but is slightly different in that submodules are also recursively generated. commit 56d64f7 Author: David Meyer <dihm.meyer@gmail.com> Date: Mon Jul 12 09:25:18 2021 -0400 Update sphinx pins to same versions as rest of suite. commit e74472c Merge: f0999f5 c543328 Author: Chris Billington <chrisjbillington@gmail.com> Date: Tue Feb 9 08:54:16 2021 +1100 Merge pull request #76 from zakv/fix-27 Work around infinite recursion in ToolPalette.resizeEvent() commit c543328 Author: Zak V <zakven@mit.edu> Date: Mon Feb 8 13:30:47 2021 -0500 Removed some python 2 debugging print statements from toolpalette.py. commit d9eb80f Author: Zak V <zakven@mit.edu> Date: Sun Feb 7 23:44:47 2021 -0500 Fixed #27; worked around bug where ToolPalette.resizeEvent() could trigger itself in an infinite resursion loop. commit f0999f5 Merge: 8371585 7d14b65 Author: Chris Billington <chrisjbillington@gmail.com> Date: Mon Jan 4 13:46:54 2021 +1100 Merge pull request #75 from chrisjbillington/master Do not use deprecated set-env command commit 7d14b65 Author: chrisjbillington <chrisjbillington@gmail.com> Date: Mon Jan 4 13:40:14 2021 +1100 Do not use deprecated set-env command commit b149e19 Author: Zak V <zakven@mit.edu> Date: Tue Nov 24 18:06:11 2020 -0500 Fixed bug in unitconversions._All._import_all() where self.__all__ wasn't always changed from None to an empty list before appending things to it.
1 parent 7534801 commit 6ee2107

File tree

7 files changed

+71
-13
lines changed

7 files changed

+71
-13
lines changed

labscript_utils/h5_lock.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def hack_locks_onto_h5py():
8989
# Monkeypatch h5py so all files are locked:
9090
h5py.File = File
9191

92-
93-
connect_to_zlock_server()
94-
hack_locks_onto_h5py()
92+
if os.environ.get('READTHEDOCS'):
93+
# prevent starting a zlock server on RTD, which always fails
94+
pass
95+
else:
96+
connect_to_zlock_server()
97+
hack_locks_onto_h5py()

labscript_utils/ls_zprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
import os
1515
from socket import gethostbyname
16-
from distutils.version import LooseVersion
16+
from packaging.version import Version
1717
import zmq
1818

1919
import zprocess
@@ -337,7 +337,7 @@ def connect_to_zlock_server():
337337
global _zlock_server_supports_readwrite
338338
if hasattr(client, 'get_protocol_version'):
339339
version = client.get_protocol_version()
340-
if LooseVersion(version) >= LooseVersion('1.1.0'):
340+
if Version(version) >= Version('1.1.0'):
341341
_zlock_server_supports_readwrite = True
342342

343343
# The user can call these functions to change the timeouts later if they

labscript_utils/modulewatcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
import os
1717
import imp
1818
import site
19-
import distutils.sysconfig
19+
import sysconfig
2020

2121

2222
# Directories in which the standard library and installed packages may be located.
2323
# Modules in these locations will be whitelisted:
2424
PKGDIRS = [
25-
distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=True),
26-
distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=False),
27-
distutils.sysconfig.get_python_lib(plat_specific=False, standard_lib=True),
28-
distutils.sysconfig.get_python_lib(plat_specific=False, standard_lib=False),
25+
sysconfig.get_path('platstdlib'),
26+
sysconfig.get_path('platlib'),
27+
sysconfig.get_path('stdlib'),
28+
sysconfig.get_path('purelib'),
2929
site.getusersitepackages(),
3030
]
3131
PKGDIRS += site.getsitepackages()

labscript_utils/splash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self, imagepath):
7272

7373
center_point = QtWidgets.QDesktopWidget().availableGeometry().center()
7474
x0, y0 = center_point.x(), center_point.y()
75-
self.move(x0 - self.w / 2, y0 - self.h / 2)
75+
self.move(x0 - self.w // 2, y0 - self.h // 2)
7676
self._first_paint_complete = False
7777

7878
def paintEvent(self, event):
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#####################################################################
2+
# #
3+
# generic_frequency.py #
4+
# #
5+
# Copyright 2022, Monash University and contributors #
6+
# #
7+
# This file is part of the labscript suite (see #
8+
# http://labscriptsuite.org) and is licensed under the Simplified #
9+
# BSD License. See the license.txt file in the root of the project #
10+
# for the full license. #
11+
# #
12+
#####################################################################
13+
"""Generic frequency conversion"""
14+
15+
from .UnitConversionBase import *
16+
17+
class FreqConversion(UnitConversion):
18+
"""
19+
A Generic frequency conversion class that covers standard SI prefixes from a base of Hz.
20+
"""
21+
22+
base_unit = 'Hz' # must be defined here and match default hardware unit in BLACS tab
23+
24+
def __init__(self, calibration_parameters = None):
25+
self.parameters = calibration_parameters
26+
if hasattr(self, 'derived_units'):
27+
self.derived_units += ['kHz', 'MHz', 'GHz']
28+
else:
29+
self.derived_units = ['kHz', 'MHz', 'GHz']
30+
UnitConversion.__init__(self,self.parameters)
31+
32+
def kHz_to_base(self,kHz):
33+
Hz = kHz*1e3
34+
return Hz
35+
36+
def kHz_from_base(self,Hz):
37+
kHz = Hz*1e-3
38+
return kHz
39+
40+
def MHz_to_base(self,MHz):
41+
Hz = MHz*1e6
42+
return Hz
43+
44+
def MHz_from_base(self,Hz):
45+
MHz = Hz*1e-6
46+
return MHz
47+
48+
def GHz_to_base(self,GHz):
49+
Hz = GHz*1e9
50+
return Hz
51+
52+
def GHz_from_base(self,Hz):
53+
GHz = Hz*1e-9
54+
return GHz

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ docs =
4343
sphinx-rtd-theme==0.5.2
4444
recommonmark==0.6.0
4545
m2r==0.2.1
46+
mistune<2.0.0
4647

4748
[options.package_data]
4849
labscript_profile = ../labscript-suite.pth

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from setuptools import setup
33
from setuptools.command.develop import develop
4-
from distutils import log
4+
import logging
55

66

77
class develop_command(develop):
@@ -11,7 +11,7 @@ def run(self):
1111
path = os.path.join(self.install_dir, 'labscript-suite.pth')
1212
super().run()
1313
if not self.uninstall:
14-
log.info(f'Copying labscript-suite.pth to {path}')
14+
logging.info(f'Copying labscript-suite.pth to {path}')
1515
if not self.dry_run:
1616
self.copy_file('labscript-suite.pth', path)
1717

0 commit comments

Comments
 (0)