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

Method _fix_version

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

Source from the content-addressed store, hash-verified

76class VersionMixin:
77
78 def _fix_version(self, filename):
79 # Replace asyncpg.__version__ with the actual version
80 # of the distribution (possibly inferred from git).
81
82 with open(str(filename)) as f:
83 content = f.read()
84
85 version_re = r"(.*__version__\s*=\s*)'[^']+'(.*)"
86 repl = r"\1'{}'\2".format(self.distribution.metadata.version)
87 content = re.sub(version_re, repl, content)
88
89 with open(str(filename), 'w') as f:
90 f.write(content)
91
92
93class sdist(setuptools_sdist.sdist, VersionMixin):

Callers 2

make_release_treeMethod · 0.80
build_moduleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected