Skip to content

Undefined name: VersioneerBadRootError on line 51#305

Merged
effigies merged 3 commits intopython-versioneer:masterfrom
cclauss:patch-1
Jul 27, 2022
Merged

Undefined name: VersioneerBadRootError on line 51#305
effigies merged 3 commits intopython-versioneer:masterfrom
cclauss:patch-1

Conversation

@cclauss
Copy link
Copy Markdown
Contributor

@cclauss cclauss commented Jul 14, 2022

VersioneerBadRootError is used on line 51 but it is never imported which may result in a NameError being raised instead.

`VersioneerBadRootError` is used on line 51 but it is never imported which may result in a NameError being raised instead.
Copy link
Copy Markdown
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way versioneer is set up is actually to concatenate these files into a single file that can be vendored:

def generate_versioneer_py():
s = io.StringIO()
s.write(get("src/header.py", add_ver=True, do_readme=True))
s.write(get("src/subprocess_helper.py", do_strip=True))
for VCS in get_vcs_list():
s.write(f"LONG_VERSION_PY['{VCS}'] = r'''\n")
s.write(generate_long_version_py(VCS))
s.write("'''\n")
s.write("\n\n")
s.write(get(f"src/{VCS}/from_keywords.py", do_strip=True))
s.write(get(f"src/{VCS}/from_vcs.py", do_strip=True))
s.write(get(f"src/{VCS}/install.py", do_strip=True))
s.write(get("src/from_parentdir.py", do_strip=True))
s.write(get("src/from_file.py", add_ver=True, do_strip=True))
s.write(get("src/render.py", do_strip=True))
s.write(get("src/get_versions.py", do_strip=True))
s.write(get("src/cmdclass.py", do_strip=True))
s.write(get("src/setupfunc.py", do_strip=True))
return s.getvalue().encode("utf-8")

To avoid multiple imports and definitions, it uses stubs that are then stripped during the build.

Comment thread src/header.py Outdated
cclauss and others added 2 commits July 14, 2022 17:11
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
@effigies effigies merged commit 2123b15 into python-versioneer:master Jul 27, 2022
@cclauss cclauss deleted the patch-1 branch July 27, 2022 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants