How to specify the `--formats` sdist option inside setup.py?

651 views Asked by At

I try to create a zipped source python package on a linux distribution without specifying the --formats option to sdist on the command line (using an existing Jenkins pipeline which do not support this option). In the documentation here, it states:

(assuming you haven’t specified any sdist options in the setup script or config file), sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.

But it doesn't say how should you specify sdist options in the setup script?

1

There are 1 answers

1
Serge Ballesta On BEST ANSWER

From the linked documentation previous topic:

The basic syntax of the configuration file is simple:

[command]
option=value
...

where command is one of the Distutils commands (e.g. build_py, install), and option is one of the options that command supports

and later an example for build_ext --inplace

[build_ext]
inplace=1

That means that you must write into the setup.cfg file:

[sdist]
formats=zip

Beware: untested because I have no available Python2...