diff options
author | David Zeuthen <davidz@redhat.com> | 2011-02-14 07:50:56 -0500 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2011-02-14 07:50:56 -0500 |
commit | 749d931cef79ea9acce0e9e4e8da36304303d551 (patch) | |
tree | 742bf342996c405aa775d6846bb2eccae8582d7c | |
parent | 3fab31f9e7bc9a8ee3ab96e5f15149bc13b44570 (diff) |
Clean up options
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/codegen.py | 37 | ||||
-rw-r--r-- | src/org.freedesktop.UDisks.Device.xml | 263 |
3 files changed, 20 insertions, 292 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index be4fd93..48fda06 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,15 +85,13 @@ libgdbus_codegen_la_LIBADD = \ # ---------------------------------------------------------------------------------------------------- -BUILT_SOURCES += test-generated.h +BUILT_SOURCES += test-generated.h test-generated.c -test-generated.h : Makefile.am org.project.xml $(codegen_PYTHON) +test-generated.h test-generated.c : Makefile.am org.project.xml $(codegen_PYTHON) $(PYTHON) ./codegen.py \ --namespace Foo \ - --include-dir src \ --strip-prefix org.project. \ - --output-hfile test-generated.h \ - --output-cfile test-generated.c \ + --generate-c-code test-generated \ --annotate "org.project.Bar" Key1 Value1 \ --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \ --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \ @@ -142,6 +140,8 @@ gdbus_example_proxymanager_LDADD = $(GLIB2_LIBS) libgen.la EXTRA_DIST += gdbus-codegen.pc.in +CLEANFILES = test-generated.[ch] + clean-local: - rm -f *~ test-* + rm -f *~ diff --git a/src/codegen.py b/src/codegen.py index e306e93..fb49ee3 100644 --- a/src/codegen.py +++ b/src/codegen.py @@ -2268,18 +2268,12 @@ def codegen_main(): help='D-Bus introspection XML file') arg_parser.add_argument('--namespace', nargs='?', metavar='NAMESPACE', default='', help='The namespace to use for generated code') - arg_parser.add_argument('--output-hfile', nargs='?', metavar='HFILE', default='generated.h', - help='Name of C header file to generate.') - arg_parser.add_argument('--output-cfile', nargs='?', metavar='CFILE', default='generated.c', - help='Name of C header file to generate.') + arg_parser.add_argument('--generate-c-code', nargs='?', metavar='OUTFILE', + help='Generate GDBus C code in OUTFILE.[ch]') arg_parser.add_argument('--strip-prefix', nargs='?', metavar='PREFIX', default='', - help='String to strip from D-Bus names.') - arg_parser.add_argument('--include-dir', nargs='?', metavar='DIR', - help='Directory to prefix #include directives with.') - arg_parser.add_argument('--add-include', nargs='?', action='append', metavar='FILE', - help='Include header file (may be used several times).') + help='String to strip from D-Bus names') arg_parser.add_argument('--annotate', nargs=3, action='append', metavar=('WHAT', 'KEY', 'VALUE'), - help='Add annotation (may be used several times).') + help='Add annotation (may be used several times)') args = arg_parser.parse_args(); all_ifaces = [] @@ -2287,25 +2281,22 @@ def codegen_main(): xml_data = f.read() f.close() parsed_ifaces = parser.parse_dbus_xml(xml_data, args.strip_prefix, args.namespace) - # TODO: apply_annotations all_ifaces.extend(parsed_ifaces) - apply_annotations(all_ifaces, args.annotate) - - #node_info = Gio.DBusNodeInfo.new_for_xml(xml_data) - #gdbus_interfaces = node_info.get_interfaces() - #if args.annotate != None: - # apply_annotations(gdbus_interfaces, args.annotate) - #for gi in gdbus_interfaces: - # all_ifaces.append(dbustypes.Interface(gi, args.strip_prefix, args.namespace)) + if args.annotate != None: + apply_annotations(all_ifaces, args.annotate) for i in parsed_ifaces: i.calculate_c_names(args.strip_prefix, args.namespace) - h = file(args.output_hfile, 'w') - c = file(args.output_cfile, 'w') - codegen = CodeGenerator(all_ifaces, args.namespace, args.strip_prefix, h, c); - sys.exit(codegen.generate()) + c_code = args.generate_c_code + if c_code: + h = file(c_code + '.h', 'w') + c = file(c_code + '.c', 'w') + codegen = CodeGenerator(all_ifaces, args.namespace, args.strip_prefix, h, c); + sys.exit(codegen.generate()) + else: + raise RuntimeError('No code generator directives found.') if __name__ == "__main__": codegen_main() diff --git a/src/org.freedesktop.UDisks.Device.xml b/src/org.freedesktop.UDisks.Device.xml deleted file mode 100644 index 394fea8..0000000 --- a/src/org.freedesktop.UDisks.Device.xml +++ /dev/null @@ -1,263 +0,0 @@ -<node> - <interface name="org.freedesktop.UDisks.Device"> - <method name="DriveBenchmark"> - <arg name="do_write_benchmark" type="b" direction="in"/> - <arg name="options" type="as" direction="in"/> - <arg name="read_transfer_rate_results" type="a(td)" direction="out"/> - <arg name="write_transfer_rate_results" type="a(td)" direction="out"/> - <arg name="access_time_results" type="a(td)" direction="out"/> - </method> - <method name="DriveAtaSmartInitiateSelftest"> - <arg name="test" type="s" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="DriveAtaSmartRefreshData"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="DriveUnsetSpindownTimeout"> - <arg name="cookie" type="s" direction="in"/> - </method> - <method name="DriveSetSpindownTimeout"> - <arg name="timeout_seconds" type="i" direction="in"/> - <arg name="options" type="as" direction="in"/> - <arg name="cookie" type="s" direction="out"/> - </method> - <method name="DriveDetach"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="DriveEject"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="DrivePollMedia"> - </method> - <method name="DriveUninhibitPolling"> - <arg name="cookie" type="s" direction="in"/> - </method> - <method name="DriveInhibitPolling"> - <arg name="options" type="as" direction="in"/> - <arg name="cookie" type="s" direction="out"/> - </method> - <method name="LinuxMdCheck"> - <arg name="options" type="as" direction="in"/> - <arg name="number_of_errors" type="t" direction="out"/> - </method> - <method name="LinuxLvm2LVStop"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LinuxMdStop"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LinuxMdRemoveComponent"> - <arg name="component" type="o" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LinuxMdExpand"> - <arg name="components" type="ao" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LinuxMdAddSpare"> - <arg name="component" type="o" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LuksChangePassphrase"> - <arg name="current_passphrase" type="s" direction="in"/> - <arg name="new_passphrase" type="s" direction="in"/> - </method> - <method name="LuksLock"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="LuksUnlock"> - <arg name="passphrase" type="s" direction="in"/> - <arg name="options" type="as" direction="in"/> - <arg name="cleartext_device" type="o" direction="out"/> - </method> - <method name="FilesystemListOpenFiles"> - <arg name="processes" type="a(uus)" direction="out"/> - </method> - <method name="FilesystemCheck"> - <arg name="options" type="as" direction="in"/> - <arg name="is_clean" type="b" direction="out"/> - </method> - <method name="FilesystemUnmount"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="FilesystemMount"> - <arg name="filesystem_type" type="s" direction="in"/> - <arg name="options" type="as" direction="in"/> - <arg name="mount_path" type="s" direction="out"/> - </method> - <method name="FilesystemSetLabel"> - <arg name="new_label" type="s" direction="in"/> - </method> - <method name="FilesystemCreate"> - <arg name="fstype" type="s" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="PartitionModify"> - <arg name="type" type="s" direction="in"/> - <arg name="label" type="s" direction="in"/> - <arg name="flags" type="as" direction="in"/> - </method> - <method name="PartitionCreate"> - <arg name="offset" type="t" direction="in"/> - <arg name="size" type="t" direction="in"/> - <arg name="type" type="s" direction="in"/> - <arg name="label" type="s" direction="in"/> - <arg name="flags" type="as" direction="in"/> - <arg name="options" type="as" direction="in"/> - <arg name="fstype" type="s" direction="in"/> - <arg name="fsoptions" type="as" direction="in"/> - <arg name="created_device" type="o" direction="out"/> - </method> - <method name="PartitionDelete"> - <arg name="options" type="as" direction="in"/> - </method> - <method name="PartitionTableCreate"> - <arg name="scheme" type="s" direction="in"/> - <arg name="options" type="as" direction="in"/> - </method> - <method name="JobCancel"> - </method> - <signal name="JobChanged"> - <arg type="b"/> - <arg type="s"/> - <arg type="u"/> - <arg type="b"/> - <arg type="d"/> - </signal> - <signal name="Changed"> - </signal> - <property name="LinuxLoopFilename" type="s" access="read"/> - <property name="LinuxDmmpParameters" type="s" access="read"/> - <property name="LinuxDmmpSlaves" type="ao" access="read"/> - <property name="LinuxDmmpName" type="s" access="read"/> - <property name="LinuxDmmpComponentHolder" type="o" access="read"/> - <property name="LinuxLvm2LVGroupUuid" type="s" access="read"/> - <property name="LinuxLvm2LVGroupName" type="s" access="read"/> - <property name="LinuxLvm2LVUuid" type="s" access="read"/> - <property name="LinuxLvm2LVName" type="s" access="read"/> - <property name="LinuxLvm2PVGroupLogicalVolumes" type="as" access="read"/> - <property name="LinuxLvm2PVGroupPhysicalVolumes" type="as" access="read"/> - <property name="LinuxLvm2PVGroupExtentSize" type="t" access="read"/> - <property name="LinuxLvm2PVGroupSequenceNumber" type="t" access="read"/> - <property name="LinuxLvm2PVGroupUnallocatedSize" type="t" access="read"/> - <property name="LinuxLvm2PVGroupSize" type="t" access="read"/> - <property name="LinuxLvm2PVGroupUuid" type="s" access="read"/> - <property name="LinuxLvm2PVGroupName" type="s" access="read"/> - <property name="LinuxLvm2PVNumMetadataAreas" type="u" access="read"/> - <property name="LinuxLvm2PVUuid" type="s" access="read"/> - <property name="LinuxMdSyncSpeed" type="t" access="read"/> - <property name="LinuxMdSyncPercentage" type="d" access="read"/> - <property name="LinuxMdSyncAction" type="s" access="read"/> - <property name="LinuxMdIsDegraded" type="b" access="read"/> - <property name="LinuxMdSlaves" type="ao" access="read"/> - <property name="LinuxMdVersion" type="s" access="read"/> - <property name="LinuxMdNumRaidDevices" type="i" access="read"/> - <property name="LinuxMdName" type="s" access="read"/> - <property name="LinuxMdHomeHost" type="s" access="read"/> - <property name="LinuxMdUuid" type="s" access="read"/> - <property name="LinuxMdLevel" type="s" access="read"/> - <property name="LinuxMdState" type="s" access="read"/> - <property name="LinuxMdComponentState" type="as" access="read"/> - <property name="LinuxMdComponentHolder" type="o" access="read"/> - <property name="LinuxMdComponentVersion" type="s" access="read"/> - <property name="LinuxMdComponentHomeHost" type="s" access="read"/> - <property name="LinuxMdComponentName" type="s" access="read"/> - <property name="LinuxMdComponentUuid" type="s" access="read"/> - <property name="LinuxMdComponentNumRaidDevices" type="i" access="read"/> - <property name="LinuxMdComponentPosition" type="i" access="read"/> - <property name="LinuxMdComponentLevel" type="s" access="read"/> - <property name="DriveAtaSmartBlob" type="ay" access="read"/> - <property name="DriveAtaSmartStatus" type="s" access="read"/> - <property name="DriveAtaSmartTimeCollected" type="t" access="read"/> - <property name="DriveAtaSmartIsAvailable" type="b" access="read"/> - <property name="OpticalDiscNumSessions" type="u" access="read"/> - <property name="OpticalDiscNumAudioTracks" type="u" access="read"/> - <property name="OpticalDiscNumTracks" type="u" access="read"/> - <property name="OpticalDiscIsClosed" type="b" access="read"/> - <property name="OpticalDiscIsAppendable" type="b" access="read"/> - <property name="OpticalDiscIsBlank" type="b" access="read"/> - <property name="DriveSimilarDevices" type="ao" access="read"/> - <property name="DrivePorts" type="ao" access="read"/> - <property name="DriveAdapter" type="o" access="read"/> - <property name="DriveIsRotational" type="b" access="read"/> - <property name="DriveCanSpindown" type="b" access="read"/> - <property name="DriveCanDetach" type="b" access="read"/> - <property name="DriveIsMediaEjectable" type="b" access="read"/> - <property name="DriveMedia" type="s" access="read"/> - <property name="DriveMediaCompatibility" type="as" access="read"/> - <property name="DriveConnectionSpeed" type="t" access="read"/> - <property name="DriveConnectionInterface" type="s" access="read"/> - <property name="DriveWriteCache" type="s" access="read"/> - <property name="DriveRotationRate" type="u" access="read"/> - <property name="DriveWwn" type="s" access="read"/> - <property name="DriveSerial" type="s" access="read"/> - <property name="DriveRevision" type="s" access="read"/> - <property name="DriveModel" type="s" access="read"/> - <property name="DriveVendor" type="s" access="read"/> - <property name="PartitionTableCount" type="i" access="read"/> - <property name="PartitionTableScheme" type="s" access="read"/> - <property name="PartitionAlignmentOffset" type="t" access="read"/> - <property name="PartitionSize" type="t" access="read"/> - <property name="PartitionOffset" type="t" access="read"/> - <property name="PartitionNumber" type="i" access="read"/> - <property name="PartitionFlags" type="as" access="read"/> - <property name="PartitionUuid" type="s" access="read"/> - <property name="PartitionLabel" type="s" access="read"/> - <property name="PartitionType" type="s" access="read"/> - <property name="PartitionScheme" type="s" access="read"/> - <property name="PartitionSlave" type="o" access="read"/> - <property name="LuksCleartextUnlockedByUid" type="u" access="read"/> - <property name="LuksCleartextSlave" type="o" access="read"/> - <property name="LuksHolder" type="o" access="read"/> - <property name="IdLabel" type="s" access="read"/> - <property name="IdUuid" type="s" access="read"/> - <property name="IdVersion" type="s" access="read"/> - <property name="IdType" type="s" access="read"/> - <property name="IdUsage" type="s" access="read"/> - <property name="JobPercentage" type="d" access="read"/> - <property name="JobIsCancellable" type="b" access="read"/> - <property name="JobInitiatedByUid" type="u" access="read"/> - <property name="JobId" type="s" access="read"/> - <property name="JobInProgress" type="b" access="read"/> - <property name="DevicePresentationIconName" type="s" access="read"/> - <property name="DevicePresentationName" type="s" access="read"/> - <property name="DevicePresentationNopolicy" type="b" access="read"/> - <property name="DevicePresentationHide" type="b" access="read"/> - <property name="DeviceBlockSize" type="t" access="read"/> - <property name="DeviceSize" type="t" access="read"/> - <property name="DeviceIsLinuxLoop" type="b" access="read"/> - <property name="DeviceIsLinuxDmmp" type="b" access="read"/> - <property name="DeviceIsLinuxDmmpComponent" type="b" access="read"/> - <property name="DeviceIsLinuxLvm2PV" type="b" access="read"/> - <property name="DeviceIsLinuxLvm2LV" type="b" access="read"/> - <property name="DeviceIsLinuxMd" type="b" access="read"/> - <property name="DeviceIsLinuxMdComponent" type="b" access="read"/> - <property name="DeviceIsLuksCleartext" type="b" access="read"/> - <property name="DeviceIsLuks" type="b" access="read"/> - <property name="DeviceMountedByUid" type="u" access="read"/> - <property name="DeviceMountPaths" type="as" access="read"/> - <property name="DeviceIsMounted" type="b" access="read"/> - <property name="DeviceIsOpticalDisc" type="b" access="read"/> - <property name="DeviceIsDrive" type="b" access="read"/> - <property name="DeviceIsReadOnly" type="b" access="read"/> - <property name="DeviceIsMediaChangeDetectionInhibited" type="b" access="read"/> - <property name="DeviceIsMediaChangeDetectionInhibitable" type="b" access="read"/> - <property name="DeviceIsMediaChangeDetectionPolling" type="b" access="read"/> - <property name="DeviceIsMediaChangeDetected" type="b" access="read"/> - <property name="DeviceIsMediaAvailable" type="b" access="read"/> - <property name="DeviceIsRemovable" type="b" access="read"/> - <property name="DeviceIsPartitionTable" type="b" access="read"/> - <property name="DeviceIsPartition" type="b" access="read"/> - <property name="DeviceIsSystemInternal" type="b" access="read"/> - <property name="DeviceFileByPath" type="as" access="read"/> - <property name="DeviceFileById" type="as" access="read"/> - <property name="DeviceFilePresentation" type="s" access="read"/> - <property name="DeviceFile" type="s" access="read"/> - <property name="DeviceMinor" type="x" access="read"/> - <property name="DeviceMajor" type="x" access="read"/> - <property name="DeviceMediaDetectionTime" type="t" access="read"/> - <property name="DeviceDetectionTime" type="t" access="read"/> - <property name="NativePath" type="s" access="read"/> - </interface> -</node> |