In Loki We Trust The many projects of Lokkju, Inc

help
partner
27Aug/100

Flex SWC class parser

Quick tool that prints out all the available classes exported by a SWC file.

Usage swfinfo.py [file [...]]

#!/usr/bin/python
# Filename: swc-info.pl
# Author : Lokkju Brennr <lokkju@lokkju.com>
# License : GPL
# Copyright 2010 

import sys
import getopt
import zipfile
from xml.etree import ElementTree

def usage():
  print "%s <swcfile>" % (sys.argv[0])
  print "  Prints all classes exported by the provided swc(s).  Supports wildcard globbing"
  sys.exit(2)

def main():
  # parse command line options
  if len(sys.argv) < 2:
    usage()
  files = sys.argv[1:]
  for swcfile in files:
    z = zipfile.ZipFile(swcfile,'r')
    catalog = z.open("catalog.xml")
    catalogxml = catalog.read()
    catalog.close()
    z.close()
    tree = ElementTree.XML(catalogxml)
    defs = tree.findall(".//{http://www.adobe.com/flash/swccatalog/9}def")
    for d in defs:
      id = d.attrib.get("id")
      type = d.attrib.get("type")
      if type is None:
        print "%s:%s" % (swcfile,id)
if __name__ == "__main__":
    main()
profile
26Aug/101

A Question of legal standing: Perhaps end users can sue for GPL violations?

A question of legal standing: I take for granted that generally, only a copyright holder has the right to sue over a GPL licence/copyright violation. Assuming that to be true, most people do not have legal standing to go after a licence/copyright violator.

But what if instead of suing for licence/copyright violations, you sued for (willful or not) fraud? As an example, lets say you had bought a "device" that was made by Acme, Inc. By whatever means, you discover that the device came with GPL licensed binaries: Linux, busybox, and mtd.
You look, but can't find an offer of source, or even a recognition of the GPL licensed software on the device.

You have now purchased a device running software that Acme had no right to sell - in essence, they sold you stolen property. Also, without that software, the device is useless. Do you have standing to sue for fraud? or something else? or do you still have no standing?

As a bonus, if you have standing, are you only eligible for reimbursement, or might you get punitive damages? Also, could you do this in small claims court?

rss
Tagged as: , , , 1 Comment
25Aug/100

Supporting dynamic FlexFileSets in Flex’s compc and mxmlc Ant tasks

If you are using the mxmlc and compc tasks in Ant to compile flex code, there is no documented way to make the fileset-like children accept a dynamic include pattern - that is, one you set based on conditionals.

In my case, I need to have a list of included libraries in my build.properties, and only include those ones in my compc task. The solution is to use patternsets and a custom ant macro. See the source below, but essentially you do the following:

  1. Create a new patternset, assigning it an id
  2. Use the append.to.patternset macro to add a new patternset for each pattern in your list of library patterns (as defined in you build.properties, or dynamically, or...)
  3. assign that patternset to the library-path of compc



Important: All the patterns must decend from the same root directory as set in the library-path. If you need multiple root directories, you must use multiple library-path directives and multiple patternset refids.


build.xml:

<?xml version="1.0" encoding="utf-8"?>
<project name="My Component Builder" basedir=".">
  <taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
  <property file="build.properties"/>
  <property name="FLEX_HOME" value="C:/flex/sdk"/>
  <property name="DEPLOY_DIR" value="c:/jrun4/servers/default/default-war"/>
  <property name="COMPONENT_ROOT" value="components"/>

  <macrodef name="append.to.patternset">
    <attribute name="patternset"/>
    <element name="nested" optional="yes" implicit="true"/>
    <sequential>
      <patternset id="tmp">
        <patternset refid="@{patternset}"/>
        <nested/>
      </patternset>
      <patternset id="@{patternset}"><patternset refid="tmp"/></patternset>
      <patternset id="tmp"/>
    </sequential>
  </macrodef>
  <patternset id="compc.library-path" />
  <for list="${compc.libraries}" param="lib">
    <sequential>
      <append.to.patternset patternset="compc.library-path">
        <patternset>
          <include name="@{lib}" />
        </patternset>
      </append.to.patternset>
    </sequential>
  </for>
  <target name="main">
    <compc
      output="${DEPLOY_DIR}/MyComps.swc"
      include-classes="custom.MyButton custom.MyLabel">
      <source-path path-element="${basedir}/components"/>
      <include-file name="f1-1.jpg" path="assets/images/f1-1.jpg"/>
      <include-file name="main.css" path="assets/css/main.css"/>
      <library-path append="true" dir="${compc.libdir}">
        <patternset refid="compc.library-path" />
      </library-path>
    </compc>
  </target>
  <target name="clean">
    <delete>
      <fileset dir="${DEPLOY_DIR}" includes="MyComps.swc"/>
    </delete>
  </target>
</project>

build.properties:

compc.libdir=${rootdir}/libs/
compc.libraries=lib1.swc,plib*.swc,**/type.swc
   
copyright
help
partner