Skip to main content

Retrieve all variables defined by make command

Project description

make_var

  • Retrieve all variables defined by make command from 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

  • just create simple Makefile containing
H = hello
W = world
  • create python file test.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'])

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']

Tutorial variable expansion

  • use same Makefile
  • 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


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.3.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

make_var-0.3.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file make_var-0.3.0.tar.gz.

File metadata

  • Download URL: make_var-0.3.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2

File hashes

Hashes for make_var-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4ce3858e6c9805bab40e6871b7b4f122291890f0c978753910facb536b1be985
MD5 78308ae9c0427261c410656fb7c8c4f6
BLAKE2b-256 94a9906e54c6cf6c2ea38d45b9d1aad645f7db0f490eefd4dd4c5ad60b4fba76

See more details on using hashes here.

File details

Details for the file make_var-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: make_var-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2

File hashes

Hashes for make_var-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10034ed0213ca6d701e3a2c15c5adabc101634d36ba990469ecb85b1e6d701e8
MD5 e51a954306b3e27c956eeafda114ef73
BLAKE2b-256 ade7cae5c81d0389430df605654c200ad4bffe4802455fac22ec174850e0555e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page