diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 7f76f5680..d514ed5f4 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.x"] + python-version: ["3.9"] steps: - uses: actions/checkout@v1 - name: Configure git @@ -98,7 +98,6 @@ jobs: run: poetry install --extras "docs lint" - name: Build documentation - if: env.PUBLISH == 'true' if: env.PUBLISH == 'true' run: | pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd diff --git a/CHANGES b/CHANGES index 764a02147..22e6d3621 100644 --- a/CHANGES +++ b/CHANGES @@ -5,14 +5,18 @@ Here you can find the recent changes to libtmux ## current - _Insert changes/features/fixes for next release here_ + +## libtmux 0.10.2 (2021-10-30) + - #324: Update poetry to 1.1 - CI: Use poetry 1.1.7 and `install-poetry.py` installer - Relock poetry.lock at 1.1 (w/ 1.1.7's fix) - #339 (CI): Lock python at 3.9 to avoid poetry issue with `dataclasses` +- ci: Fix publishing docs (similar to #339) - #341 #342: `Server.attached_sessions()` now supports multiple attached sessions. Remove attached sessions limitation to not detect multiple attached clients, - thank you @Timoses + thank you @timoses ## libtmux 0.10.1 (2021-06-16) - Update `Window.select_window()` for #271 diff --git a/libtmux/__about__.py b/libtmux/__about__.py index a4bad5553..83a36e61b 100644 --- a/libtmux/__about__.py +++ b/libtmux/__about__.py @@ -1,6 +1,6 @@ __title__ = 'libtmux' __package_name__ = 'libtmux' -__version__ = '0.10.1' +__version__ = '0.10.2' __description__ = 'scripting library / orm for tmux' __email__ = 'tony@git-pull.com' __author__ = 'Tony Narlock' diff --git a/libtmux/formats.py b/libtmux/formats.py index 9887162fb..76550c536 100644 --- a/libtmux/formats.py +++ b/libtmux/formats.py @@ -7,6 +7,10 @@ """ +from __future__ import absolute_import, unicode_literals, with_statement + +FORMAT_SEPERATOR = "|" + SESSION_FORMATS = [ 'session_name', 'session_windows', diff --git a/libtmux/server.py b/libtmux/server.py index 8e27417be..7c5b33545 100644 --- a/libtmux/server.py +++ b/libtmux/server.py @@ -142,7 +142,9 @@ def _list_sessions(self): sformats = formats.SESSION_FORMATS tmux_formats = ['#{%s}' % f for f in sformats] - tmux_args = ('-F%s' % '\t'.join(tmux_formats),) # output + tmux_args = ( + '-F%s' % formats.FORMAT_SEPERATOR.join(tmux_formats), + ) # output proc = self.cmd('list-sessions', *tmux_args) @@ -154,7 +156,17 @@ def _list_sessions(self): sessions = proc.stdout # combine format keys with values returned from ``tmux list-sessions`` - sessions = [dict(zip(sformats, session.split('\t'))) for session in sessions] + sessions = [ + dict( + zip( + sformats, + session.split( + formats.FORMAT_SEPERATOR + ) + ) + ) + for session in sessions + ] # clear up empty dict sessions = [ @@ -207,7 +219,9 @@ def _list_windows(self): proc = self.cmd( 'list-windows', # ``tmux list-windows`` '-a', - '-F%s' % '\t'.join(tmux_formats), # output + '-F%s' % formats.FORMAT_SEPERATOR.join( + tmux_formats + ), # output ) if proc.stderr: @@ -218,7 +232,17 @@ def _list_windows(self): wformats = ['session_name', 'session_id'] + formats.WINDOW_FORMATS # combine format keys with values returned from ``tmux list-windows`` - windows = [dict(zip(wformats, window.split('\t'))) for window in windows] + windows = [ + dict( + zip( + wformats, + window.split( + formats.FORMAT_SEPERATOR + ) + ) + ) + for window in windows + ] # clear up empty dict windows = [dict((k, v) for k, v in window.items() if v) for window in windows] @@ -267,7 +291,10 @@ def _list_panes(self): 'window_id', 'window_name', ] + formats.PANE_FORMATS - tmux_formats = ['#{%s}\t' % f for f in pformats] + tmux_formats = [ + ('#{%%s}%s' % formats.FORMAT_SEPERATOR) % f + for f in pformats + ] proc = self.cmd('list-panes', '-a', '-F%s' % ''.join(tmux_formats)) # output @@ -285,7 +312,17 @@ def _list_panes(self): ] + formats.PANE_FORMATS # combine format keys with values returned from ``tmux list-panes`` - panes = [dict(zip(pformats, window.split('\t'))) for window in panes] + panes = [ + dict( + zip( + pformats, + window.split( + formats.FORMAT_SEPERATOR + ) + ) + ) + for window in panes + ] # clear up empty dict panes = [ @@ -526,7 +563,7 @@ def new_session( tmux_args = ( '-s%s' % session_name, '-P', - '-F%s' % '\t'.join(tmux_formats), # output + '-F%s' % formats.FORMAT_SEPERATOR.join(tmux_formats), # output ) if not attach: @@ -557,7 +594,7 @@ def new_session( os.environ['TMUX'] = env # combine format keys with values returned from ``tmux list-windows`` - session = dict(zip(sformats, session.split('\t'))) + session = dict(zip(sformats, session.split(formats.FORMAT_SEPERATOR))) # clear up empty dict session = dict((k, v) for k, v in session.items() if v) diff --git a/libtmux/session.py b/libtmux/session.py index cd6af00a0..c7b9d6ebe 100644 --- a/libtmux/session.py +++ b/libtmux/session.py @@ -217,7 +217,9 @@ def new_window( start_directory = os.path.expanduser(start_directory) window_args += ('-c%s' % start_directory,) - window_args += ('-F"%s"' % '\t'.join(tmux_formats),) # output + window_args += ( + '-F"%s"' % formats.FORMAT_SEPERATOR.join(tmux_formats), + ) # output if window_name: window_args += ('-n%s' % window_name,) @@ -237,7 +239,14 @@ def new_window( window = proc.stdout[0] - window = dict(zip(wformats, window.split('\t'))) + window = dict( + zip( + wformats, + window.split( + formats.FORMAT_SEPERATOR + ) + ) + ) # clear up empty dict window = dict((k, v) for k, v in window.items() if v) diff --git a/libtmux/window.py b/libtmux/window.py index e62e8dfe3..9d52c99b7 100644 --- a/libtmux/window.py +++ b/libtmux/window.py @@ -434,7 +434,10 @@ def split_window( 'window_index', 'window_id', ] + formats.PANE_FORMATS - tmux_formats = ['#{%s}\t' % f for f in pformats] + tmux_formats = [ + ('#{%%s}%s' % formats.FORMAT_SEPERATOR) % f + for f in pformats + ] # '-t%s' % self.attached_pane.get('pane_id'), # 2013-10-18 LOOK AT THIS, rm'd it.. @@ -478,7 +481,7 @@ def split_window( else: pane = pane.stdout[0] - pane = dict(zip(pformats, pane.split('\t'))) + pane = dict(zip(pformats, pane.split(formats.FORMAT_SEPERATOR))) # clear up empty dict pane = dict((k, v) for k, v in pane.items() if v) diff --git a/pyproject.toml b/pyproject.toml index 5becf1659..f101bdcd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ skip-string-normalization = true [tool.poetry] name = "libtmux" -version = "0.10.1" +version = "0.10.2" description = "scripting library / orm for tmux" license = "MIT" authors = ["Tony Narlock "]