Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
1f108b0b
Commit
1f108b0b
authored
Apr 08, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
missing script
parent
946ddbaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
fixswigimports.py
scripting/fixswigimports.py
+55
-0
No files found.
scripting/fixswigimports.py
0 → 100755
View file @
1f108b0b
#!/usr/bin/env python
# the purpose of this script is rewriting the swig_import_helper
# call so it will not load _xxxxx.so/dso from inside a kicad executable
# because the kicad executable itself sill provide an _xxxxx module
# that's linked inside itself.
#
# for the normal module import it should work the same way with this
# fix in the swig_import_helper
#
from
sys
import
argv
,
exit
if
len
(
argv
)
<
2
:
print
"usage:"
print
" fixswigimports.py file.py"
print
""
print
" will fix the swig import code for working inside KiCad"
print
" where it happended that the external _pcbnew.so/dll was"
print
" loaded too -and the internal _pcbnew module was to be used"
exit
(
1
)
filename
=
argv
[
1
]
f
=
open
(
filename
,
"rb"
)
lines
=
f
.
readlines
()
f
.
close
()
f
=
open
(
filename
,
"wb"
)
doneOk
=
False
for
l
in
lines
:
if
l
.
startswith
(
"if version_info >= (2,6,0):"
):
l
=
l
.
replace
(
"version_info >= (2,6,0)"
,
"False"
)
doneOk
=
True
elif
l
.
startswith
(
"if False:"
):
# it was already patched?
doneOk
=
True
f
.
write
(
l
)
f
.
close
()
if
doneOk
:
print
"swig_import_helper fixed for"
,
filename
else
:
print
"Error: the swig import helper was not fixed, check"
,
filename
print
" and fix this script: fixswigimports.py"
exit
(
2
)
exit
(
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment