Ejemplo n.º 1
0
    def test_create_exe(self):
        # FIXME: do a real test here
        meta, sections, nodes = create_simple_ipkg_args(self.top_node)
        ipkg = BuildManifest(sections, meta, {})

        fid, arcname = tempfile.mkstemp(prefix="zip")
        try:
            create_exe(ipkg, arcname, "some-name.exe")
        finally:
            os.close(fid)
Ejemplo n.º 2
0
 def test_simple(self):
     build_manifest = BuildManifest(self.sections, self.meta, {})
     sections = build_manifest.resolve_paths(self.top_node)
     res = sorted([(kind, source.abspath(), target.abspath()) \
                   for kind, source, target in iter_files(sections)])
     target_dir = build_manifest.resolve_path(os.path.join("$prefix", "target"))
     ref = [("pythonfiles", os.path.join(self.top_node.abspath(), "source", "scripts", "bar.py"),
                            os.path.join(target_dir, "scripts", "bar.py")),
            ("pythonfiles", os.path.join(self.top_node.abspath(), "source", "scripts", "foo.py"),
                            os.path.join(target_dir, "scripts", "foo.py"))]
     self.assertEqual(res, ref)
Ejemplo n.º 3
0
    def test_simple_roundtrip(self):
        # FIXME: we compare the loaded json to avoid dealing with encoding
        # differences when comparing objects, but this is kinda stupid
        r_build_manifest = BuildManifest(self.sections, self.meta, {})
        f = StringIO()
        r_build_manifest._write(f)
        r_s = f.getvalue()

        build_manifest = BuildManifest.from_string(r_s)
        f = StringIO()
        build_manifest._write(f)
        s = f.getvalue()
        
        self.assertEqual(json.loads(r_s), json.loads(s))
Ejemplo n.º 4
0
 def test_simple(self):
     """This just tests whether create_wininst runs at all and produces a zip-file."""
     ipackage = BuildManifest({}, {"name": "foo", "version": "1.0"}, {})
     create_wininst(ipackage,
                    self.build_node,
                    self.build_node,
                    wininst="foo.exe",
                    output_dir="dist")
     arcname = bento.commands.build_wininst.create_exe.call_args[0][1]
     fp = zipfile.ZipFile(arcname)
     try:
         fp.namelist()
     finally:
         fp.close()
Ejemplo n.º 5
0
    def test_create_exe(self):
        # FIXME: do a real test here
        meta, sections, nodes = create_simple_build_manifest_args(self.top_node)
        build_manifest = BuildManifest(sections, meta, {})

        fid, arcname = tempfile.mkstemp(prefix="zip")
        try:
            f = tempfile.NamedTemporaryFile(suffix=".exe")
            try:
                create_exe(build_manifest, arcname, f.name)
            finally:
                f.close()
        finally:
            os.close(fid)
Ejemplo n.º 6
0
 def store(self, filename, pkg):
     meta = ipkg_meta_from_pkg(pkg)
     p = BuildManifest(self.sections, meta, pkg.executables)
     if not op.exists(op.dirname(filename)):
         os.makedirs(op.dirname(filename))
     p.write(filename)
Ejemplo n.º 7
0
 def test_simple_create(self):
     BuildManifest(self.sections, self.meta, {})
Ejemplo n.º 8
0
 def test_get_inidata_run(self):
     """Simply execute get_inidata."""
     # FIXME: do a real test here
     meta, sections, nodes = create_simple_ipkg_args(self.top_node)
     ipkg = BuildManifest(sections, meta, {})
     get_inidata(ipkg)