Burgerlib Python
Loading...
Searching...
No Matches
burger.setuputils Namespace Reference

Package that contains setup.py helper functions. More...

Functions

 _output_entry (lines, key, data, tabs=" ", tabs2=" ")
 Create an entry for a python dict.
 _setup_dynamic (project, tool)
 Process the dynamic variables in pyproject.toml.
 _setup_process_entries (lines, project, keyword_list, remap=None, tabs=" ", tabs2=" ")
 Handle the list of common entries.
 _setup_find_url (lines, project)
 Locate the most likely URL for the homepage.
 _setup_find_license_file (lines, project)
 Degrade license-files to license_file.
 _setup_find_readme_file (lines, project)
 Insert the readme file into the metadata.
 _setup_find_packages (lines, setuptools_entry)
 Find the entries packages and package_data
 create_setup_py (toml_name=None, setup_name=None)
 Create a setup.py for setuptools.

Variables

tuple _SETUP_URL_LIST
 Homepage urls in order of precedence.
tuple _PROJECT_KEYWORDS
 Keywords to process in project dict.
dict _PROJECT_REMAP
 Keywords to remap for project dict to setup.py.
tuple _SETUPTOOLS_KEYWORDS
 Keywords to process in setuptools dict.
dict _SETUPTOOLS_REMAP
 Keywords to remap for setuptools dict to setup.py.

Detailed Description

Package that contains setup.py helper functions.

Functions to generate setup.py

Function Documentation

◆ _output_entry()

burger.setuputils._output_entry ( lines,
key,
data,
tabs = "    ",
tabs2 = "        " )
protected

Create an entry for a python dict.

Given a list of entries, a data key, and the data, determine how to output the data and append the lines to the lines stream

Tabs can either be a string or a number. If a number, it's multipied by space and that is the string inserted into the line entrie(s)

Parameters
lineslist of lines for final output
keydict key to generate
datadata attached to the dict key
tabsindentation
tabs2secondary indentation for list entries

◆ _setup_dynamic()

burger.setuputils._setup_dynamic ( project,
tool )
protected

Process the dynamic variables in pyproject.toml.

Scan the project dict for a "dynamic" entry, and if one exists, parse the tool dict for those entries and copy them directly into the project dict.

This will modify the project dict with the parsed data, and in some cases file loaded data.

Note
At this time, only attr is supported. file support to be added later
Parameters
project"project" dict entry from the toml file
tool"tool" dict entry from the toml file

◆ _setup_find_license_file()

burger.setuputils._setup_find_license_file ( lines,
project )
protected

Degrade license-files to license_file.

pyproject.toml supports multiple license files, setup.py supports only one. Use the first license file.

Parameters
lineslist of lines for final output
projectdict of data from the toml file

◆ _setup_find_packages()

burger.setuputils._setup_find_packages ( lines,
setuptools_entry )
protected

Find the entries packages and package_data

Parameters
lineslist of lines for final output
setuptools_entrydict of data from the toml file

◆ _setup_find_readme_file()

burger.setuputils._setup_find_readme_file ( lines,
project )
protected

Insert the readme file into the metadata.

Since this loads a file a compile time, a code snippet is inserted into the setup.py file that generates a global variable called LONG_DESCRIPTION. This variable is used to set the entry long_description.

Parameters
lineslist of lines for final output
projectdict of data from the toml file

◆ _setup_find_url()

burger.setuputils._setup_find_url ( lines,
project )
protected

Locate the most likely URL for the homepage.

Check for which URL is found using the list setuputils._SETUP_URL_LIST. The first one found will be marked at the setup.py homepage.

Parameters
lineslist of lines for final output
projectdict of data from the toml file

◆ _setup_process_entries()

burger.setuputils._setup_process_entries ( lines,
project,
keyword_list,
remap = None,
tabs = "    ",
tabs2 = "        " )
protected

Handle the list of common entries.

Iterate over the keyword list on the dict project. All matching entries are then sent to _output_entry() for output. Keywords are remapped via the remap table so that keys that are for pyproject.toml are remapped to keys suitable for setup.py

Parameters
lineslist of lines for final output
projectdict of data from the toml file
keyword_listList of keywords to scan
remapList of keywords to swap to alternate keywords
tabsindentation
tabs2secondary indentation for list entries
See also
_output_entry

◆ create_setup_py()

burger.setuputils.create_setup_py ( toml_name = None,
setup_name = None )

Create a setup.py for setuptools.

The latest setuptools uses pyproject.toml for all the settings, but wheels packaged this way don't properly install using older versions of pip.

To get around this issue, a setup.py file is generated from the data in pyproject.toml for inclusion of the distributed wheel, so python 2.7's version of pip can still properly install the python module

Parameters
toml_nameName of the pyproject.toml file. Default is pyproject.toml
setup_nameName of the setup.py file. Default is setup.py