~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to release/datafiles/ctodata.py

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# ***** BEGIN GPL LICENSE BLOCK *****
 
5
#
 
6
# This program is free software; you can redistribute it and/or
 
7
# modify it under the terms of the GNU General Public License
 
8
# as published by the Free Software Foundation; either version 2
 
9
# of the License, or (at your option) any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program; if not, write to the Free Software Foundation,
 
18
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
19
#
 
20
# The Original Code is Copyright (C) 2009 Blender Foundation.
 
21
# All rights reserved.
 
22
#
 
23
# Contributor(s): Campbell Barton
 
24
#
 
25
# ***** END GPL LICENCE BLOCK *****
 
26
 
 
27
 
 
28
# <pep8 compliant>
 
29
 
 
30
import sys
 
31
 
 
32
if len(sys.argv) < 2:
 
33
    sys.stdout.write("Usage: ctodata <c_file>\n")
 
34
    sys.exit(1)
 
35
 
 
36
filename = sys.argv[1]
 
37
 
 
38
try:
 
39
    fpin = open(filename, "r")
 
40
except:
 
41
    sys.stdout.write("Unable to open input %s\n" % sys.argv[1])
 
42
    sys.exit(1)
 
43
 
 
44
data = fpin.read().rsplit("{")[-1].split("}")[0]
 
45
data = data.replace(",", " ")
 
46
data = data.split()
 
47
data = [int(v) for v in data]
 
48
# for some reason all data gets trailing byte
 
49
last = data.pop()
 
50
assert(last == 0)
 
51
data = bytes(data)
 
52
 
 
53
dname = filename + ".ctodata"
 
54
 
 
55
sys.stdout.write("Making DATA file <%s>\n" % dname)
 
56
 
 
57
try:
 
58
    fpout = open(dname, "wb")
 
59
except:
 
60
    sys.stdout.write("Unable to open output %s\n" % dname)
 
61
    sys.exit(1)
 
62
 
 
63
size = fpout.write(data)
 
64
 
 
65
sys.stdout.write("%d\n" % size)