Commit 67f44b41 by Eric Coissac

--no commit message

parent e0e4b8b8
......@@ -5,6 +5,7 @@ Created on 20 oct. 2012
'''
from distutils.command.build import build as ori_build
from obidistutils.serenity.checksystem import is_mac_system
class build(ori_build):
......@@ -24,7 +25,11 @@ class build(ori_build):
def has_littlebigman(self):
return True
def has_pidname(self):
return is_mac_system()
sub_commands = [('littlebigman', has_littlebigman),
('pidname',has_pidname)
('build_ctools', has_ctools),
('build_files', has_files),
('build_cexe', has_executables),
......
'''
Created on 20 oct. 2012
@author: coissac
'''
import os
from obidistutils.command.build_exe import build_exe
from obidistutils.serenity.checksystem import is_mac_system
class pidname(build_exe):
description = "build the pidname executable returning the executable path from a PID on a mac"
def initialize_options(self):
build_exe.initialize_options(self)
self.pidname = False
def finalize_options(self):
# This might be confusing: both build-cexe and build-temp default
# to build-temp as defined by the "build" command. This is because
# I think that C libraries are really just temporary build
# by-products, at least from the point of view of building Python
# extensions -- but I want to keep my options open.
build_exe.finalize_options(self)
self.set_undefined_options('build',
('build_scripts', 'build_cexe'))
# self.ctools = self.distribution.ctools
if os.path.isfile("src/pidname.c"):
self.executables = [('pidname',{"sources":["src/pidname.c"]})]
self.check_executable_list(self.executables)
else:
self.executables = []
def run(self):
if is_mac_system():
build_exe.run(self)
self.pidname=True
else:
self.pidname=False
\ No newline at end of file
......@@ -29,6 +29,7 @@ from obidistutils.command.build_files import build_files
from obidistutils.command.build_scripts import build_scripts
from obidistutils.command.install_scripts import install_scripts
from obidistutils.command.install import install
from obidistutils.command.pidname import pidname
from obidistutils.dist import Distribution
......@@ -118,6 +119,7 @@ def rootname(x):
COMMANDS = {'build':build,
'littlebigman':littlebigman,
'pidname':pidname,
'build_ctools':build_ctools,
'build_files':build_files,
'build_cexe':build_cexe,
......
/*
* littlebigman.c
*
* Created on: 11 juil. 2012
* Author: coissac
*/
#include<stdio.h>
int main(int argc, char *argv[])
{
union { int entier;
char caractere[4] ;
} test;
test.entier=0x01020304;
if (test.caractere[3] == 1)
printf("-DLITTLE_END");
else
printf("-DBIG_END");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <libproc.h>
int main (int argc, char* argv[])
{
pid_t pid; int ret;
char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
if ( argc > 1 ) {
pid = (pid_t) atoi(argv[1]);
ret = proc_pidpath (pid, pathbuf, sizeof(pathbuf));
if ( ret <= 0 ) {
fprintf(stderr, "PID %d: proc_pidpath ();\n", pid);
fprintf(stderr, " %s\n", strerror(errno));
} else {
printf("proc %d: %s\n", pid, pathbuf);
}
}
return 0;
}
......@@ -4142,6 +4142,7 @@ import zipimport
import importlib
import glob
import tarfile
import stat
from distutils.version import LooseVersion
......@@ -4277,6 +4278,25 @@ def main():
os.system(command)
activate = os.path.join(current,'obitools')
binpath = os.path.join(virtualenvname,'bin')
python = os.path.join(binpath,'python')
with open(activate,"w") as fp:
print >>fp,"#!%s" % python
print >>fp
print >>fp,"import os"
print >>fp,"ppid = os.getppid()"
print >>fp,"if os.path.islink('/proc/%d/exe' % ppid):"
print >>fp,' shell = os.path.realpath("/proc/%d/exe" % ppid)'
print >>fp,"else:"
print >>fp,"os.environ['PATH']='%s:%s' % (binpath,os.environ['PATH'])"
print >>fp,"os.execlp(shell,shell)"
print >>fp
st = os.stat(activate)
os.chmod(activate, st.st_mode | stat.S_IEXEC)
cleanModules()
......
......@@ -68,7 +68,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor
s["taxid_dist"][seq.id]=seq['taxid']
mkey = "merged_%s" % key
#cas ou on met jour les merged_keys mais il n'y a pas de merged_keys dans la sequence qui arrive
#cas ou on met a jour les merged_keys mais il n'y a pas de merged_keys dans la sequence qui arrive
if key in seq:
s[mkey][seq[key]]=s[mkey].get(seq[key],0)+1
#cas ou merged_keys existe deja
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment