File: kde_generate_export_header

package info (click to toggle)
kde-dev-scripts 4%3A18.08.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,496 kB
  • sloc: perl: 15,466; lisp: 5,627; sh: 4,157; python: 3,892; ruby: 2,158; makefile: 16; sed: 9
file content (61 lines) | stat: -rwxr-xr-x 1,876 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/env python

import os, sys

def help():
        print("Usage: %s foo_export.h FOO_EXPORT libname" % sys.argv[0])

if len(sys.argv) < 4:
        help()
        sys.exit()

filename=sys.argv[1]
FOO_EXPORT=sys.argv[2]
LIBNAME=sys.argv[3].upper()
HEADER_PROTECTION=filename.upper().replace('.','_')

file=open(filename,'w')
file.write("\
/*  This file is part of the KDE project\n\
    Copyright (C) 2007 David Faure <faure@kde.org>\n\
\n\
    This library is free software; you can redistribute it and/or\n\
    modify it under the terms of the GNU Library General Public\n\
    License as published by the Free Software Foundation; either\n\
    version 2 of the License, or (at your option) any later version.\n\
\n\
    This library is distributed in the hope that it will be useful,\n\
    but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\
    Library General Public License for more details.\n\
\n\
    You should have received a copy of the GNU Library General Public License\n\
    along with this library; see the file COPYING.LIB.  If not, write to\n\
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n\
    Boston, MA 02110-1301, USA.\n\
*/\n\
\n\
#ifndef %(HEADER_PROTECTION)s\n\
#define %(HEADER_PROTECTION)s\n\
\n\
/* needed for KDE_EXPORT and KDE_IMPORT macros */\n\
#include <kdemacros.h>\n\
\n\
#ifndef %(FOO_EXPORT)s\n\
# if defined(MAKE_%(LIBNAME)s_LIB)\n\
   /* We are building this library */\n\
#  define %(FOO_EXPORT)s KDE_EXPORT\n\
# else\n\
   /* We are using this library */\n\
#  define %(FOO_EXPORT)s KDE_IMPORT\n\
# endif\n\
#endif\n\
\n\
# ifndef %(FOO_EXPORT)s_DEPRECATED\n\
#  define %(FOO_EXPORT)s_DEPRECATED KDE_DEPRECATED %(FOO_EXPORT)s\n\
# endif\n\
\n\
#endif\n" % vars())
file.close()

os.system("svn add "+filename)