diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 50f0cde..054bfe5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,9 @@
+v1.15.5
+=======
+
+* fix #167 by correctly respecting preformatted version metadata
+  from PKG-INFO/EGG-INFO
+
 v1.15.4
 =======
 
diff --git a/setuptools_scm/hacks.py b/setuptools_scm/hacks.py
index 2d298be..add89a8 100644
--- a/setuptools_scm/hacks.py
+++ b/setuptools_scm/hacks.py
@@ -10,7 +10,7 @@ def parse_pkginfo(root):
     data = data_from_mime(pkginfo)
     version = data.get('Version')
     if version != 'UNKNOWN':
-        return meta(version)
+        return meta(version, preformatted=True)
 
 
 def parse_pip_egg_info(root):
diff --git a/setuptools_scm/version.py b/setuptools_scm/version.py
index 15c4495..dce8c75 100644
--- a/setuptools_scm/version.py
+++ b/setuptools_scm/version.py
@@ -55,7 +55,10 @@ def tags_to_versions(tags):
 class ScmVersion(object):
     def __init__(self, tag_version,
                  distance=None, node=None, dirty=False,
+                 preformatted=False,
                  **kw):
+        if kw:
+            trace("unknown args", kw)
         self.tag = tag_version
         if dirty and distance is None:
             distance = 0
@@ -64,6 +67,7 @@ class ScmVersion(object):
         self.time = datetime.datetime.now()
         self.extra = kw
         self.dirty = dirty
+        self.preformatted = preformatted
 
     @property
     def exact(self):
@@ -84,13 +88,19 @@ class ScmVersion(object):
         return self.format_with(dirty_format if self.dirty else clean_format)
 
 
-def meta(tag, distance=None, dirty=False, node=None, **kw):
+def _parse_tag(tag, preformatted):
+    if preformatted:
+        return tag
     if SetuptoolsVersion is None or not isinstance(tag, SetuptoolsVersion):
         tag = tag_to_version(tag)
-    trace('version', tag)
+    return tag
+
 
+def meta(tag, distance=None, dirty=False, node=None, preformatted=False, **kw):
+    tag = _parse_tag(tag, preformatted)
+    trace('version', tag)
     assert tag is not None, 'cant parse version %s' % tag
-    return ScmVersion(tag, distance, node, dirty, **kw)
+    return ScmVersion(tag, distance, node, dirty, preformatted, **kw)
 
 
 def guess_next_version(tag_version, distance):
@@ -147,6 +157,8 @@ def postrelease_version(version):
 def format_version(version, **config):
     trace('scm version', version)
     trace('config', config)
+    if version.preformatted:
+        return version.tag
     version_scheme = callable_or_entrypoint(
         'setuptools_scm.version_scheme', config['version_scheme'])
     local_scheme = callable_or_entrypoint(

setuptools_scm unable to compute distance?
I have a tarball that was built with a previous version of setuptools_scm. The other day it started failing because the version number it was producing was ``1.None.0``. Nothing in the code base had changed, so I believe it to be a setuptools_scm regression.

This tarball is private, but the ``setup.py`` looks like:

```python
#!/usr/bin/env python
import setuptools


setuptools.setup(
    name="pypi-theme",
    version="15.0",

    packages=[
        "pypi_theme",
    ],

    include_package_data=True,

    use_scm_version={
        "local_scheme": "dirty-tag",
        "version_scheme": lambda v: "1.{.distance}.0".format(v),
    },

    install_requires=[
        "Pyramid",
    ],

    setup_requires=["setuptools_scm"],
)
```

I'm guessing that ``v.distance`` is returning ``None`` now when it previously didn't, but I don't know why.
diff --git a/testing/conftest.py b/testing/conftest.py
index 49a9d14..29e129c 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -52,14 +52,18 @@ class Wd(object):
         self(self.add_command)
         self.commit(reason=reason)
 
-    @property
-    def version(self):
+    def get_version(self, **kw):
         __tracebackhide__ = True
         from setuptools_scm import get_version
-        version = get_version(root=str(self.cwd))
+        version = get_version(root=str(self.cwd), **kw)
         print(version)
         return version
 
+    @property
+    def version(self):
+        __tracebackhide__ = True
+        return self.get_version()
+
 
 @pytest.yield_fixture(autouse=True)
 def debug_mode():
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index 5f9e1d6..4192f71 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -30,6 +30,9 @@ def test_version_from_pkginfo(wd):
     wd.write('PKG-INFO', 'Version: 0.1')
     assert wd.version == '0.1'
 
+    # replicate issue 167
+    assert wd.get_version(version_scheme="1.{0.distance}.0".format) == '0.1'
+
 
 def assert_root(monkeypatch, expected_root):
     """

pip install -e .
parse_log_pytest
requirements.txt
pytest flake8 mccabe readme wheel twine devpi-client
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
bleach==4.1.0
build==0.9.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
check-manifest==0.48
colorama==0.4.5
cryptography==40.0.2
devpi-client==6.0.7
devpi-common==3.7.2
docutils==0.18.1
flake8==5.0.4
idna==3.10
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
jeepney==0.7.1
keyring==23.4.1
lazy==1.6
mccabe==0.7.0
packaging==21.3
pep517==0.13.1
pkginfo==1.10.0
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
readme==0.7.1
readme-renderer==34.0
requests==2.27.1
requests-toolbelt==1.0.0
rfc3986==1.5.0
SecretStorage==3.3.3
-e git+https://github.com/pypa/setuptools_scm.git@00f3fbe0dfd3ae396abdd4b33cd69cca7d4459c3#egg=setuptools_scm
six==1.17.0
tomli==1.2.3
tqdm==4.64.1
twine==3.8.0
typing_extensions==4.1.1
urllib3==1.26.20
webencodings==0.5.1
zipp==3.6.0

name: setuptools_scm
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - bleach==4.1.0
      - build==0.9.0
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - check-manifest==0.48
      - colorama==0.4.5
      - cryptography==40.0.2
      - devpi-client==6.0.7
      - devpi-common==3.7.2
      - docutils==0.18.1
      - flake8==5.0.4
      - idna==3.10
      - importlib-metadata==4.2.0
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - jeepney==0.7.1
      - keyring==23.4.1
      - lazy==1.6
      - mccabe==0.7.0
      - packaging==21.3
      - pep517==0.13.1
      - pkginfo==1.10.0
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pycparser==2.21
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - readme==0.7.1
      - readme-renderer==34.0
      - requests==2.27.1
      - requests-toolbelt==1.0.0
      - rfc3986==1.5.0
      - secretstorage==3.3.3
      - six==1.17.0
      - tomli==1.2.3
      - tqdm==4.64.1
      - twine==3.8.0
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - webencodings==0.5.1
      - zipp==3.6.0
prefix: /opt/conda/envs/setuptools_scm

testing/test_basic_api.py::test_version_from_pkginfo
testing/test_basic_api.py::test_do[ls] testing/test_basic_api.py::test_do[dir] testing/test_basic_api.py::test_data_from_mime testing/test_basic_api.py::test_root_parameter_creation testing/test_basic_api.py::test_root_parameter_pass_by testing/test_basic_api.py::test_pretended testing/test_basic_api.py::test_root_relative_to testing/test_basic_api.py::test_dump_version testing/test_basic_api.py::test_parse_plain
setuptools_scm/version.py CHANGELOG.rst setuptools_scm/hacks.py
setuptools_scm/version.py CHANGELOG.rst setuptools_scm/hacks.py