flit
flit copied to clipboard
error: unknown option `recurse-submodules' when using `flit publish`
Looks like flit publish
fails if you have git 2.7.4 installed (in my case, this is the git I get from apt install git
on Ubuntu 16.04 which is in LTS until 2021-04).
For what it's worth I find all the shenanigans with git
a bit surprising and I'm extremely unlikely to upgrade git
just to use this tool.
Error log:
(pypng) ac1xdrj@owl:~/prj/pypng/code$ flit publish
error: unknown option `recurse-submodules'
usage: git ls-files [<options>] [<file>...]
-z paths are separated with NUL character
-t identify the file status with tags
-v use lowercase letters for 'assume unchanged' files
-c, --cached show cached files in the output (default)
-d, --deleted show deleted files in the output
-m, --modified show modified files in the output
-o, --others show other files in the output
-i, --ignored show ignored files in the output
-s, --stage show staged contents' object name in the output
-k, --killed show files on the filesystem that need to be removed
--directory show 'other' directories' names only
--empty-directory don't show empty directories
-u, --unmerged show unmerged files in the output
--resolve-undo show resolve-undo information
-x, --exclude <pattern>
skip files matching pattern
-X, --exclude-from <file>
exclude patterns are read from <file>
--exclude-per-directory <file>
read additional per-directory exclude patterns in <file>
--exclude-standard add the standard git exclusions
--full-name make the output relative to the project top directory
--error-unmatch if any <file> is not in the index, treat this as an error
--with-tree <tree-ish>
pretend that paths removed since <tree-ish> are still present
--abbrev[=<n>] use <n> digits to display SHA-1s
--debug show debugging data
Traceback (most recent call last):
File "/home/ac1xdrj/miniconda3/envs/pypng/bin/flit", line 10, in <module>
sys.exit(main())
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit/__init__.py", line 163, in main
main(args.ini_file, repository, formats=set(args.format or []),
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit/upload.py", line 257, in main
built = build.main(ini_path, formats=formats, gen_setup_py=gen_setup_py)
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit/build.py", line 46, in main
sdist_file = sb.build(dist_dir, gen_setup_py=gen_setup_py)
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit_core/sdist.py", line 182, in build
files_to_add = self.apply_includes_excludes(self.select_files())
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit/sdist.py", line 155, in select_files
for p in vcs_mod.list_tracked_files(self.cfgdir)]
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/site-packages/flit/vcs/git.py", line 7, in list_tracked_files
outb = check_output(['git', 'ls-files', '--recurse-submodules', '-z'],
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/ac1xdrj/miniconda3/envs/pypng/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'ls-files', '--recurse-submodules', '-z']' returned non-zero exit status 129.
(pypng) ac1xdrj@owl:~/prj/pypng/code$ which git
/usr/bin/git
(pypng) ac1xdrj@owl:~/prj/pypng/code$ git --version
git version 2.7.4
(pypng) ac1xdrj@owl:~/prj/pypng/code$ lsb_release
No LSB modules are available.
(pypng) ac1xdrj@owl:~/prj/pypng/code$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.7 LTS
Release: 16.04
Codename: xenial
(pypng) ac1xdrj@owl:~/prj/pypng/code$
Ugh, sorry, I forgot to check when that flag was introduced, and assumed it was old enough that we could safely rely on it.
That was added in flit 2.3 (see #323). So one workaround is to downgrade to flit 2.2 for making releases until you upgrade Ubuntu & git. You can check the release notes to see if you need any of the fixes in 2.3 or 3.0, but most of them are fairly minor.
downgrading flit should be a good workaround, good idea!
Tried uninstalling latest flit and installing ==2.2. Now I get ”No module named 'flit_core.inifile'” when I try to publish. Have tried un- and re-installing flit and flit-core, but no joy, error remains.
Never mind, I reinstalled the whole box.
Tried uninstalling latest flit and installing ==2.2. Now I get ”No module named 'flit_core.inifile'”
Sorry about that, it probably needs an older flit_core
as well - i.e. pip install flit==2.2 flit_core==2.2
.
For the record, I tried several combos of flit and flit-core versions, but the problem persisted.
But now happily flitting away on my up-to-date machine.
Ubuntu 16.04 is no longer in support, so hopefully everyone now has a new enough version of git to avoid this. If not, you can now describe what you want in your sdist in pyproject.toml
and pass a --no-use-vcs
flag to skip interacting with git. This will likely become the default in Flit 4.