Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  rcgen

  Sprache: C
 

#!/usr/bin/env python3

# Helper for building resource files when building for windows. Always
# generates a .rc from the input .rc file. When building with msvc we
# additionally generate a .res file with 'rc', when building with gcc, we use
# windres to directly generate a .o.  Additionally we generate basic
# dependencies if depfile is specified.

import argparse
import os
import subprocess
import sys

parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')

parser.add_argument('--srcdir', type=os.path.abspath,
                    required=True)
parser.add_argument('--builddir', type=os.path.abspath,
                    required=True)

binaries = parser.add_argument_group('binaries')
binaries.add_argument('--windres', type=os.path.abspath)
binaries.add_argument('--rc', type=os.path.abspath)

inout = parser.add_argument_group('inout')
inout.add_argument('--depfile', type=argparse.FileType('w'))
inout.add_argument('--input', type=argparse.FileType('r'),
                   required=True)
inout.add_argument('--rcout', type=argparse.FileType('w'),
                   required=True)
inout.add_argument('--out', type=str,
                   required=True)

replacements = parser.add_argument_group('replacements')
replacements.add_argument('--FILEDESC', type=str)
replacements.add_argument('--NAME', type=str, required=True)
replacements.add_argument('--VFT_TYPE', type=str, required=True)
replacements.add_argument('--FILEENDING', type=str, required=True)
replacements.add_argument('--ICO', type=str)

args = parser.parse_args()

# determine replacement strings

internal_name = '"{0}"'.format(args.NAME)
original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)

# if no description is passed in, generate one based on the name
if args.FILEDESC:
    filedesc = args.FILEDESC
elif args.NAME:
    if args.VFT_TYPE == 'VFT_DLL':
        filedesc = 'PostgreSQL {0} library'.format(args.NAME)
    else:
        filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
filedesc = '"{0}"'.format(filedesc)


if args.ICO:
    ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
    if args.depfile:
        args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
else:
    ico = ''


data = args.input.read()

data = data.replace('VFT_APP', args.VFT_TYPE)
data = data.replace('_INTERNAL_NAME_', internal_name)
data = data.replace('_ORIGINAL_NAME_', original_name)
data = data.replace('FILEDESC', filedesc)
data = data.replace("_ICO_", ico)

args.rcout.write(data)
args.rcout.close()

if args.windres:
    cmd = [
        args.windres,
        '-I{0}/src/include/'.format(args.builddir),
        '-I{0}/src/include/'.format(args.srcdir),
        '-o', args.out, '-i', args.rcout.name,
    ]
elif args.rc:
    cmd = [
        args.rc, '/nologo',
        '-I{0}/src/include/'.format(args.builddir),
        '-I{0}/src/include/'.format(args.srcdir),
        '/fo', args.out, args.rcout.name,
    ]
else:
    sys.exit('either --windres or --rc needs to be specified')

sp = subprocess.run(cmd)
if sp.returncode != 0:
    sys.exit(sp.returncode)

# It'd be nicer if we could generate correct dependencies here, but 'rc'
# doesn't support doing so. It's unlikely we'll ever need more, so...
if args.depfile:
    args.depfile.write("{0} : {1}\n".format(
        args.rcout.name, args.input.name))
    args.depfile.write("{0} : {1}/{2}\n".format(
        args.out, args.builddir, 'src/include/pg_config.h'))

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-08-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002