warner-python-ed25519-0.4-0-gdeb78a0.tar.gz
warner-python-ed25519-deb78a0/
and unpack into python-ed25519-0.4/ .
add .gitattributes, with “_version.py export-subst”
then put
might be possible to get github’s ‘git archive’ to put the tag name into a _version.py file
- commit a _version.py with a s=”$Format:%d$” and some massaging code
- need to parse, strip boring refs, return highest non-boring one
- __init__.py pulls massaged string from _version.py
- ‘setup.py build’ does git-describe and replaces _version.py with a one-line variable set
- trouble: modifying a committed file, VCS will complain
- avoid by subclassing ‘build’, only modify build/lib../../_version.py
- ‘setup.py sdist’ does git-describe and replaces _version.py
- less trouble with modifying a committed file, if we always do sdist from a clean checkout (which is probably a good idea anyways)
- ?? need to do git-describe from _version.py, eww
in modified state, and you don’t want to accidentally replace that _version.py
- might be possible for ‘setup.py build’, since we can get control after
the superclass method has run
- ‘setup.py build’ uses distutils.command.build_py build_py.build_module to copy things into the build directory, can use to figure out the _version.py to modify. Check for hardlinks. Hm, looks like build doesn’t use hardlinks, although sdist does.
- probably not so possible for ‘setup.py sdist’. But maybe that’s ok.
- actually, cmd.sub_commands=[] is a list of (name,runp) that are invoked after self.filelist is created (but not populated), could be used to invoke extra commands
- self.make_release_tree() is what creates the tree that will be
archived.. could override that, modify _version.py on the way out
- good to know: make_release_tree() creates hardlinks if possible. If ‘setup.py build’ does this too, that would explain why it’s not always necessary to rebuild when source files are changed.
- need to ensure _version.py is not a link before changing it
- make_release_tree(base_dir, files) creates os.path.join(base_dir,f) for f in files
- ‘setup.py build’ runs superclass, looks for .git, if present:
- use git-describe
- locate build/STUFF/../_version.py
- replace it with one-line string variable set
- if no .git, assume the version number is already good, leave it alone
- ‘setup.py sdist’ looks for .git first, modifies _version.py in source tree, then runs superclass
- _version.py will need to import that
- need version_from_expanded_variable() in versioneer.py too, not just _version.py