Skip to main content

Grab files from a vendor tar file.

Project description

Vendor Grab

Download gzipped tar files from URLs and extract only selected files to destination paths in current working directory.

Configuration file is in TOML format. Takes a list of vendors that can have multiple files.

[[vendors]]
archive = "https://github.com/csstools/normalize.css/archive/refs/tags/12.0.0.tar.gz"

# Verify the downloaded tar file with this sha256 hash hexdigest.
checksum = "0820f46861766b7aef99ffd1601e61279d399700e1683e7863f9400af068e3ed"

# The dst_checksum is optional. Delete it to always replace dst files from the downloaded tar file.
#dst_checksum = ""

# The strip_components will default to 1. It is the same as --strip-components flag in tar command.
#strip_components = 1

[[vendors.files]]
# The source (src) of the file in the tar (with the first component stripped off
# since it is usually a directory with the version.
src = "normalize.css"
# The destination (dst) is where it extracts the file to.
dst = "vendor/normalize.css/normalize.css"

# It is common to grab any license files and include them along with source
# files.
[[vendors.files]]
src = "LICENSE.md"
dst = "vendor/normalize.css/LICENSE.md"

The created dst files can be committed to source control (git, fossil, etc.) and if the dst_checksum fields are set; it won't needlessly fetch the tar file each time. This also prevents the vendor dst files from being modified without also updating the dst_checksum value.

Install

pip install vendor_grab

Usage

Create a configuration file in TOML format that has 'vendors' list. See example above or the example-vendors.toml file in this project.

Pass the configuration file as the only arg:

vendor_grab example-vendors.toml

View the downloaded files in the 'vendors' directory (if using the example-vendors.toml configuration file).

Why?

The Simplest Thing That Could Possibly Work.

Why use a tool like npm to download some CSS files? That was the main reason I created this script. I did not need all the capability (and potential security holes) that the npm tool provided. I simply wanted to automate getting some vendor files into my git repository and keep them up to date.

Initially this script started off as a messy shell script that used jq, wget, md5sum commands. It also used JSON for the configuration, which isn't great for adding inline comments. It was rewritten in Python to be more compatible and easier to follow.

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

vendor_grab-0.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

vendor_grab-0.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file vendor_grab-0.0.1.tar.gz.

File metadata

  • Download URL: vendor_grab-0.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for vendor_grab-0.0.1.tar.gz
Algorithm Hash digest
SHA256 440c3ceecdaca81b8234b6dc1dd7e8d2f61ddf4cb7b0295214bf54bf10c3cee0
MD5 55bd361a8469761e6d7b72e2c9f9ae7b
BLAKE2b-256 4c18eb4593dfe9cf2b9b422cc4b90a3e9686b175a28df21582d557b5f5965e2d

See more details on using hashes here.

File details

Details for the file vendor_grab-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: vendor_grab-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for vendor_grab-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 373394613f8e3b2eaa582fff746007c79212793011830fdc9fc321446ed27e14
MD5 74f3e72c10e6d16c9f57713d9f5f89f7
BLAKE2b-256 8b63c6c37f3ad5bf8ab0d482ca5fbedad5da7288eb155999bb5d5e60f51d00c0

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