Skip to content

Commit a048604

Browse files
committed
Update for fabric3.0
1 parent d653591 commit a048604

File tree

13 files changed

+94
-111
lines changed

13 files changed

+94
-111
lines changed

dev-requirements.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "patchwork"
7+
version = "2.0.0"
8+
description = "Deployment/sysadmin operations, powered by Fabric"
9+
authors = [{ name = "Jeff Forcier", email = "[email protected]" }]
10+
maintainers = [{ name = "Jeff Forcier", email = "[email protected]" }]
11+
requires-python = ">=3.6.2"
12+
readme = "README.rst"
13+
license = { file = "LICENSE" }
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Environment :: Console",
17+
"Intended Audience :: Developers",
18+
"Intended Audience :: System Administrators",
19+
"License :: OSI Approved :: BSD License",
20+
"Operating System :: POSIX",
21+
"Operating System :: Unix",
22+
"Operating System :: MacOS :: MacOS X",
23+
"Operating System :: Microsoft :: Windows",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 2",
26+
"Programming Language :: Python :: 2.7",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.4",
29+
"Programming Language :: Python :: 3.5",
30+
"Programming Language :: Python :: 3.6",
31+
"Topic :: Software Development",
32+
"Topic :: Software Development :: Build Tools",
33+
"Topic :: Software Development :: Libraries",
34+
"Topic :: Software Development :: Libraries :: Python Modules",
35+
"Topic :: System :: Software Distribution",
36+
"Topic :: System :: Systems Administration",
37+
]
38+
39+
dependencies = [
40+
"fabric>=3.0",
41+
]
42+
43+
[project.optional-dependencies]
44+
docs = [
45+
"releases",
46+
"alabaster",
47+
"sphinx",
48+
]
49+
test = [
50+
"invocations",
51+
"pytest",
52+
"mock",
53+
"pytest-relaxed",
54+
]
55+
test-cov = [
56+
"pytest-cov",
57+
]
58+
dev = [
59+
"patchwork[test]",
60+
]
61+
62+
[project.urls]
63+
homepage = "https://www.fabfile.org/"
64+
65+
[tool.pytest.ini_options]
66+
testpaths = ["tests"]
67+
python_files = "*"

setup.cfg

Lines changed: 0 additions & 14 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 48 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

patchwork/environment.py renamed to src/patchwork/environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def have_program(c, name):
77
"""
88
Returns whether connected user has program ``name`` in their ``$PATH``.
99
"""
10-
return c.run("which {}".format(name), hide=True, warn=True)
10+
return c.run(f"which {name}", hide=True, warn=True)

patchwork/files.py renamed to src/patchwork/files.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import re
66

7-
from invoke.vendor import six
8-
97
from .util import set_runner
108

119

@@ -25,12 +23,12 @@ def directory(c, runner, path, user=None, group=None, mode=None):
2523
:param str mode:
2624
``chmod`` compatible mode string to apply to the directory.
2725
"""
28-
runner("mkdir -p {}".format(path))
26+
runner(f"mkdir -p {path}")
2927
if user is not None:
3028
group = group or user
31-
runner("chown {}:{} {}".format(user, group, path))
29+
runner(f"chown {user}:{group} {path}")
3230
if mode is not None:
33-
runner("chmod {} {}".format(mode, path))
31+
runner(f"chmod {mode} {path}")
3432

3533

3634
@set_runner
@@ -78,8 +76,8 @@ def contains(c, runner, filename, text, exact=False, escape=True):
7876
if escape:
7977
text = _escape_for_regex(text)
8078
if exact:
81-
text = "^{}$".format(text)
82-
egrep_cmd = 'egrep "{}" "{}"'.format(text, filename)
79+
text = f"^{text}$"
80+
egrep_cmd = f'egrep "{text}" "{filename}"'
8381
return runner(egrep_cmd, hide=True, warn=True).ok
8482

8583

@@ -116,7 +114,7 @@ def append(c, runner, filename, text, partial=False, escape=True):
116114
Whether to perform regex-oriented escaping on ``text``.
117115
"""
118116
# Normalize non-list input to be a list
119-
if isinstance(text, six.string_types):
117+
if isinstance(text, str):
120118
text = [text]
121119
for line in text:
122120
regex = "^" + _escape_for_regex(line) + ("" if partial else "$")
@@ -127,7 +125,7 @@ def append(c, runner, filename, text, partial=False, escape=True):
127125
):
128126
continue
129127
line = line.replace("'", r"'\\''") if escape else line
130-
runner("echo '{}' >> {}".format(line, filename))
128+
runner(f"echo '{line}' >> {filename}")
131129

132130

133131
def _escape_for_regex(text):

patchwork/info.py renamed to src/patchwork/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def distro_name(c):
2929
}
3030
for name, sentinels in sentinel_files.items():
3131
for sentinel in sentinels:
32-
if exists(c, "/etc/{}".format(sentinel)):
32+
if exists(c, f"/etc/{sentinel}"):
3333
return name
3434
return "other"
3535

patchwork/packages/__init__.py renamed to src/patchwork/packages/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# apt/deb, rpm/yum/dnf, arch/pacman, etc etc etc.
77

88

9-
from patchwork.info import distro_family
9+
from ..info import distro_family
1010

1111

1212
def package(c, *packages):
@@ -29,4 +29,4 @@ def rubygem(c, gem):
2929
"""
3030
Install a Ruby gem.
3131
"""
32-
return c.sudo("gem install -b --no-rdoc --no-ri {}".format(gem))
32+
return c.sudo(f"gem install -b --no-rdoc --no-ri {gem}")

0 commit comments

Comments
 (0)