-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from lpsinger/process-non-py-binaries
Process non-Python binaries (e.g. binary executables)
- Loading branch information
Showing
5 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from setuptools import setup | ||
import subprocess | ||
|
||
cmd = 'gcc testpackage/testprogram.c -lgsl -o testpackage/testprogram' | ||
subprocess.check_call(cmd.split()) | ||
|
||
setup( | ||
name='testpackage', | ||
version='0.0.1', | ||
packages=['testpackage'], | ||
package_data={'testpackage': ['testprogram']} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import pkg_resources | ||
import subprocess | ||
|
||
|
||
def runit(x): | ||
filename = pkg_resources.resource_filename(__name__, 'testprogram') | ||
output = subprocess.check_output([filename, str(x)]) | ||
return float(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* A simple example program to square a number using GSL. */ | ||
|
||
#include <gsl/gsl_math.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
double x; | ||
char *startptr, *endptr; | ||
|
||
if (argc != 2) | ||
{ | ||
fputs("Expected exactly one command line argument\n", stderr); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
startptr = argv[1]; | ||
endptr = NULL; | ||
x = strtod(startptr, &endptr); | ||
|
||
if (startptr == endptr) | ||
{ | ||
fputs("Expected command line argument to be a float\n", stderr); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
x = gsl_pow_2(x); | ||
printf("%g\n", x); | ||
return EXIT_SUCCESS; | ||
} |