From cec463e8301d38b536867ec16204cd60e0272d6e Mon Sep 17 00:00:00 2001
From: Patrick Ziegler
Date: Thu, 17 Dec 2020 05:12:09 +0100
Subject: [PATCH 1/4] doc: Don't use git for checking version number (#2311)
If git is not available (and it doesn't have to be when building from a
source archive) building the documentation fails because we use
`git rev-parse` to determine whether a certain version is unreleased.
We now use the version.txt file to do this check
This uses the packaging library, but this should not introduce a new
dependency because sphinx depends on setuptools which also depends on
that library.
Fixes #2309
---
doc/conf.py | 36 +++++++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/doc/conf.py b/doc/conf.py
index a68eaa55..13567506 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -13,11 +13,31 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
+from pathlib import Path
import datetime
-import subprocess
-from docutils.nodes import Node
from typing import List
+from docutils.nodes import Node
from sphinx.domains.changeset import VersionChange
+import packaging.version
+
+def get_version():
+ """
+ Searches for the version.txt file and extracts the version from it
+
+ Searches up the directory tree from the conf.py file because depending on the
+ build method, the conf.py file will be at a different location (because it is
+ configured by cmake)
+ """
+ current_path = Path(__file__).parent
+ while current_path != current_path.parent:
+ candidate = current_path / "version.txt"
+ if candidate.exists():
+ with open(candidate, "r") as f:
+ for line in f.readlines():
+ if not line.startswith("#"):
+ return packaging.version.parse(line)
+ current_path = current_path.parent
+
# -- Project information -----------------------------------------------------
@@ -41,6 +61,11 @@ else:
# The full version, including alpha/beta/rc tags
release = version
+# The version from the version.txt file. Since we are not always first
+# configured by cmake, we don't necessarily have access to the current version
+# number
+version_txt = get_version()
+
# Set path to documentation
if on_rtd:
# On readthedocs conf.py is already in the doc folder
@@ -213,12 +238,9 @@ class VersionDirective(VersionChange):
deprecated and adds an unreleased tag to versions that are not yet released
"""
def run(self) -> List[Node]:
- # If the tag exists 'git rev-parse' will succeed and otherwise fail
- completed = subprocess.run(["git", "rev-parse", self.arguments[0]],
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=doc_path,
- check=False)
+ directive_version = packaging.version.parse(self.arguments[0])
- if completed.returncode != 0:
+ if directive_version > version_txt:
self.arguments[0] += " (unreleased)"
return super().run()
From 1bf89e8b7661fdfb784be889838b173f0457e4b0 Mon Sep 17 00:00:00 2001
From: Patrick Ziegler
Date: Thu, 17 Dec 2020 14:02:48 +0100
Subject: [PATCH 2/4] fix(docs): Support out-of-tree builds (#2312)
Searching up from the conf.py only works if it is inside the repository
and not for out-of-tree builds (because conf.py gets configured in the
build directory).
---
doc/conf.py | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/doc/conf.py b/doc/conf.py
index 13567506..94d10cbe 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -20,23 +20,17 @@ from docutils.nodes import Node
from sphinx.domains.changeset import VersionChange
import packaging.version
-def get_version():
+def get_version(root_path):
"""
- Searches for the version.txt file and extracts the version from it
+ Reads the polybar version from the version.txt at the root of the repo.
+ """
+ path = Path(root_path) / "version.txt"
+ with open(path, "r") as f:
+ for line in f.readlines():
+ if not line.startswith("#"):
+ return packaging.version.parse(line)
- Searches up the directory tree from the conf.py file because depending on the
- build method, the conf.py file will be at a different location (because it is
- configured by cmake)
- """
- current_path = Path(__file__).parent
- while current_path != current_path.parent:
- candidate = current_path / "version.txt"
- if candidate.exists():
- with open(candidate, "r") as f:
- for line in f.readlines():
- if not line.startswith("#"):
- return packaging.version.parse(line)
- current_path = current_path.parent
+ raise RuntimeError("No version found in {}".format(path))
@@ -61,11 +55,6 @@ else:
# The full version, including alpha/beta/rc tags
release = version
-# The version from the version.txt file. Since we are not always first
-# configured by cmake, we don't necessarily have access to the current version
-# number
-version_txt = get_version()
-
# Set path to documentation
if on_rtd:
# On readthedocs conf.py is already in the doc folder
@@ -75,6 +64,11 @@ else:
# build folder.
doc_path = '@doc_path@'
+# The version from the version.txt file. Since we are not always first
+# configured by cmake, we don't necessarily have access to the current version
+# number
+version_txt = get_version(Path(doc_path).absolute().parent)
+
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
From 33e691301dc0cc8ff2a171bac1653365e8962d73 Mon Sep 17 00:00:00 2001
From: Patrick Ziegler
Date: Fri, 18 Dec 2020 23:33:03 +0100
Subject: [PATCH 3/4] fix(config): Don't treat an empty value as invalid
(#2315)
An empty color value in the config should be treated as if no color was
specified (explicitly). This is the same behavior as before.
---
src/components/config.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/components/config.cpp b/src/components/config.cpp
index a94aaee2..5be2c223 100644
--- a/src/components/config.cpp
+++ b/src/components/config.cpp
@@ -225,6 +225,10 @@ chrono::duration config::convert(string&& value) const {
template <>
rgba config::convert(string&& value) const {
+ if (value.empty()) {
+ return rgba{};
+ }
+
rgba ret{value};
if (!ret.has_color()) {
From 64649a1e473c488d25aad126f0c2ce35a6af1dac Mon Sep 17 00:00:00 2001
From: patrick96
Date: Wed, 23 Dec 2020 17:32:15 +0100
Subject: [PATCH 4/4] Release 3.5.3
---
CHANGELOG.md | 21 +++++++++++++++++++++
version.txt | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..eed88973
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,21 @@
+
+# Changelog
+
+All notable changes to this project will be documented in this file.
+Each release should have the following subsections, if entries exist, in the
+given order: `Breaking`, `Build`, `Deprecated`, `Removed`, `Added`, `Changed`,
+`Fixed`, `Security`.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [3.5.3] - 2020-12-23
+### Build
+- Don't use `git` when building documentation ([`#2311`](https://github.com/polybar/polybar/issues/2309))
+### Fixed
+- Empty color values are no longer treated as invalid and no longer produce an error.
+
+[Unreleased]: https://github.com/polybar/polybar/compare/3.5.3...HEAD
+[3.5.3]: https://github.com/polybar/polybar/releases/tag/3.5.3
diff --git a/version.txt b/version.txt
index 2bd23581..af8cdbfd 100644
--- a/version.txt
+++ b/version.txt
@@ -1,4 +1,4 @@
# Polybar version information
# Update this on every release
# This is used to create the version string if a git repo is not available
-3.5.2
+3.5.3