MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _fix_version

Method _fix_version

setup.py:87–99  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

85class VersionMixin:
86
87 def _fix_version(self, filename):
88 # Replace asyncpg.__version__ with the actual version
89 # of the distribution (possibly inferred from git).
90
91 with open(str(filename)) as f:
92 content = f.read()
93
94 version_re = r"(.*__version__\s*=\s*)'[^']+'(.*)"
95 repl = r"\1'{}'\2".format(self.distribution.metadata.version)
96 content = re.sub(version_re, repl, content)
97
98 with open(str(filename), 'w') as f:
99 f.write(content)
100
101
102class sdist(setuptools_sdist.sdist, VersionMixin):

Callers 2

make_release_treeMethod · 0.80
build_moduleMethod · 0.80

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected