Retrieve all variables defined by make command
Project description
make_var
- Retrieve all variables defined by make command by python
- Expand make type variables
$(VAR)
in string
Package allow you to access any symbol defined in make. It might be helpful to transfer your Makefile based project to different one.
Installation
pip install make_var
Tutorial
How to use package:
- just create simple Makefile containing variables H and W
H = hello
W = world
- next create python file
read_makefile.py
#!/usr/bin/env python3
from make_var import *
M=make_vars(origin=['makefile']) # retrieve only data defined in makefiles
print(M['makefile']['H'], M['makefile']['W'])
execute it and you get
hello world
- to get all variables that
make
uses just write
M=make_vars(origin=None) # all variables
print(M.keys()) # print all origins
output is
['environment', "'override'", 'automatic', 'makefile', 'default']
String expansion
Example to replace $(var) by definition from Makefile
- use same Makefile as before
- edit python file
print(make_expand(M,"$(H) $(W)")) # replaces $(H) with "hello" and $(W) with "word"
you get
hello world
Internals
package is based on GNU make command
make -pnB
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
make_var-0.4.0.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file make_var-0.4.0.tar.gz
.
File metadata
- Download URL: make_var-0.4.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a785e83a1fb8621e655afa3249628177212c89f400ec301d995af43ec162b8d3 |
|
MD5 | 67bed2bfd13f351772dacd438933520e |
|
BLAKE2b-256 | d109fa8b35cdc8229d742d6b585274844400860fd3b51464de3da778b317ebd0 |
File details
Details for the file make_var-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: make_var-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40541db09a29ea27325109b4798897ce0bf9f53eeba48e01506cf3920d7fc275 |
|
MD5 | e01bd69a17a858c4fee395bb62b39b74 |
|
BLAKE2b-256 | d6a541749da4afa229b315326306ec0d92a37d596231651d21d2887464e9bf5d |