Skip to main content

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

Metadata

Release files for make-var 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for make-var 0.4.0
File Size Uploaded
make_var-0.4.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for make-var 0.4.0
File Interpreter ABI Platform
make_var-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / make_var-0.4.0.tar.gz

Download URL make_var-0.4.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a785e83a1fb8621e655afa3249628177212c89f400ec301d995af43ec162b8d3
BLAKE2b-256 checksum
How to use checksums
d109fa8b35cdc8229d742d6b585274844400860fd3b51464de3da778b317ebd0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / make_var-0.4.0-py3-none-any.whl

Download URL make_var-0.4.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40541db09a29ea27325109b4798897ce0bf9f53eeba48e01506cf3920d7fc275
BLAKE2b-256 checksum
How to use checksums
d6a541749da4afa229b315326306ec0d92a37d596231651d21d2887464e9bf5d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page