Sha256: 416debffe0c44d30bbd0da2fc13f5fce10a74e0d68d59ea2606a2aff3ba982eb

Contents?: true

Size: 1.98 KB

Versions: 25

Compression:

Stored size: 1.98 KB

Contents

#!/usr/bin/env python

# Utilities to facilitate maintaining one master list of package contents 
# in MANIFEST.in and allow us to import that list into various packaging 
# tools (e.g. rpmbuid and setup.py).

# Define the file in which we maintain package contents. Rather than 
# hard-coding our package contents, to ease maintenance we read the 
# manifest file to obtain the list of files and directories to include.
MANIFEST_IN = 'MANIFEST.in'

# Define input and output files for customizing the rpm package spec.
SPEC_IN = 'gsutil.spec.in'
SPEC_OUT = 'gsutil.spec'

# Root of rpmbuild tree for file enumeration in gsutil.spec file.
RPM_ROOT = '%{_datadir}/%{name}/'

def parse_manifest(files, dirs):
  '''Parse contents of manifest file and append results to passed lists
     of files and directories.
  '''
  f = open(MANIFEST_IN, 'r')
  for line in f:
    line = line.strip()
    # Skip empty or comment lines.
    if (len(line) <= 0) or (line[0] == '#'):
      continue
    tokens = line.split()
    if len(tokens) >= 0:
      if tokens[0] == 'include':
        files.extend(tokens[1:])
      elif tokens[0] == 'recursive-include' and tokens[2] == '*':
        dirs.append(tokens[1])
      else:
        err = 'Unsupported type ' + tokens[0] + ' in ' + MANIFEST_IN + ' file.'
        raise Exception(err)
  f.close()

# When executed as a separate script, create a dynamically generated rpm 
# spec file. Otherwise, when loaded as a module by another script, no
# specific actions are taken, other than making utility functions available
# to the loading script.
if __name__ == '__main__':
  # Running as main so generate a new rpm spec file.
  files = []
  dirs = []
  parse_manifest(files, dirs)
  fin = open(SPEC_IN, 'r')
  fout = open(SPEC_OUT, 'w')
  for line in fin:
    if line.strip() == '###FILES_GO_HERE###':
      for file in files:
        fout.write(RPM_ROOT + file + '\n')
      for dir in dirs:
        fout.write(RPM_ROOT + dir + '/\n')
    else:
      fout.write(line)
  fout.close()
  fin.close()

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
libv8-5.3.332.38.5 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.4 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.3 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.2 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.1 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.0 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.3.332.38.0beta2 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.2.361.43.1 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.2.361.43.0 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.1.281.59.1 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.1.281.59.0 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.1.281.59.0beta3 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.0.71.48.3 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.0.71.48.2 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-5.0.71.48.0beta2 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-4.5.95.5 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-4.5.95.4 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-4.5.95.3 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-4.5.95.2 vendor/depot_tools/third_party/gsutil/pkg_util.py
libv8-4.5.95.1 vendor/depot_tools/third_party/gsutil/pkg_util.py