14 import os, os.path, re, time, commands, sys
22 MAKE_SURE_IS_COPYABLE = [
23 "core::conformation::Residue",
31 all_scons_files = [f
for f
in commands.getoutput(
'ls *.src.settings').
split()
if f
not in [
'apps.src.settings',
'devel.src.settings',
'pilot_apps.src.settings']]
32 for scons_file
in all_scons_files:
33 f = file(scons_file).
read(); exec(f)
37 _SconsFiles.append( (k +
'/' + f).replace(
'//',
'/'))
39 return fname
in _SconsFiles
59 'utility/query',
'core/coarse',
62 'utility/py/PyHelper.hh',
'utility/keys',
'utility/options',
'utility/options/keys',
65 'basic/options/keys',
'utility/exit.hh',
66 'numeric/xyzVector.hh',
68 'numeric/PCA.hh',
'numeric/linear_algebra/GeneralizedEigenSolver.hh',
'protocols/forge/remodel/RemodelGlobalFrame.hh',
'protocols/forge/remodel/RemodelLoopMover.hh',
69 'protocols/simple_filters/RepeatParameterFilter.hh',
73 'core/scoring/etable/BaseMembEtableEnergy.hh',
74 'core/scoring/etable/CoarseEtableEnergyCreator.hh',
75 'core/scoring/memb_etable/BaseMembEtableEnergy.hh',
76 'core/scoring/rna/RNA_FA_Stack.hh',
77 'core/scoring/methods/GaussianOverlapEnergyCreator.hh',
79 'core/scoring/fiber_diffraction/FiberDiffractionEnergyGpuCreator.hh',
80 'core/scoring/fiber_diffraction/FiberDiffractionEnergyGpu.hh',
81 'core/scoring/fiber_diffraction/FiberDiffractionKernelGpu.hh',
83 'protocols/forge/remodel/RemodelLoopMoverCreator.hh',
88 'protocols/abinitio/JumpingFoldConstraints.hh',
90 'protocols/filters/RGFilterCreator.hh',
91 'protocols/flxbb/InterlockAromaCreator.hh',
92 'protocols/moves/ChangeFoldTreeMover.hh',
94 'protocols/jd2/MultiThreadingJob.hh',
98 'protocols/canonical_sampling/mc_convergence_checks/MPIBPool_ConvergenceCheck.hh',
99 'protocols/canonical_sampling/mc_convergence_checks/MPIHPool_ConvergenceCheck.hh',
100 'protocols/canonical_sampling/mc_convergence_checks/MPIPool_ConvergenceCheck.hh',
102 'protocols/moves/ReportToDB.hh',
106 'protocols/jd3/job_distributors',
107 'protocols/jd3/pose_inputters',
108 'protocols/jd3/pose_outputters',
109 'protocols/jd3/MoverAndPoseJob.hh',
110 'protocols/jd3/JobDistributor.fwd.hh',
111 'protocols/jd3/LarvalJob.fwd.hh',
112 'protocols/jd3/pose_outputters/PDBPoseOutputter.hh',
113 'protocols/jd3/pose_outputters/PDBPoseOutputter.fwd.hh',
114 'protocols/jd3/PoseOutputter.fwd.hh',
115 'protocols/jd3/PoseInputter.hh',
116 'protocols/jd3/pose_inputters/PDBPoseInputter.hh',
117 'protocols/jd3/pose_inputters/PDBPoseInputter.fwd.hh',
118 'protocols/jd3/pose_inputters/util.hh',
119 'protocols/jd3/pose_inputters/SilentFilePoseInputter.hh',
120 'protocols/jd3/PoseInputterFactory.hh',
121 'protocols/jd3/StandardJobQueen.fwd.hh',
122 'protocols/jd3/JobResult.hh',
123 'protocols/jd3/MoverAndPoseJob.fwd.hh',
124 'protocols/jd3/SilentFilePoseInputter.hh',
125 'protocols/jd3/JobDistributor.hh',
126 'protocols/jd3/job_distributors/MultiThreadedJobDistributor.hh',
127 'protocols/jd3/job_distributors/MPIWorkPartitionJobDistributor.hh',
128 'protocols/jd3/job_distributors/MPIWorkPoolJobDistributor.hh',
129 'protocols/jd3/JobOutputWritter.hh',
130 'protocols/jd3/PoseInputSource.hh',
131 'protocols/jd3/InnerLarvalJob.fwd.hh',
132 'protocols/jd3/Job.hh',
133 'protocols/jd3/PoseOutputter.hh',
134 'protocols/jd3/PoseInputSource.fwd.hh',
135 'protocols/jd3/Job.fwd.hh',
136 'protocols/jd3/JobDistributorFactory.fwd.hh',
137 'protocols/jd3/PoseInputter.fwd.hh',
138 'protocols/jd3/InnerLarvalJob.hh',
139 'protocols/jd3/JobQueen.hh',
140 'protocols/jd3/JobQueen.fwd.hh',
141 'protocols/jd3/StandardJobQueen.hh',
142 'protocols/jd3/JobResult.fwd.hh',
143 'protocols/jd3/JobDistributorFactory.hh',
144 'protocols/jd3/LarvalJob.hh',
147 'protocols/swa/rna/StepWiseRNA_Classes.hh',
157 'utility/vectorL.hh',
158 'numeric/kdtree/WrappedType.hh',
160 'protocols/simple_moves/SymmetricFragmentMover.hh',
164 'utility/sql_database/DatabaseSessionManager.hh',
166 'protocols/nonlocal/DistributionSampler.hh',
170 'protocols/qsar/scoring_grid',
171 'protocols/noesy_assign',
173 'protocols/nonlocal/Chunk.hh',
174 'protocols/nonlocal',
176 'protocols/medal/MedalMain.hh',
201 'numeric/random/DistributionSampler.hh', # problem with interger been too large (gccxml) #include <boost/math/distributions.hpp>
204 'core/io/silent/ProteinSilentStruct.tmpl.hh',
206 'core/io/silent/BinaryProteinSilentStruct.hh',
207 'core/io/silent/BinaryRNASilentStruct.hh',
208 'core/io/silent/ProteinSilentStruct.hh',
215 ''' Check if given path or file name is banned from PyRosetta
217 if fname
in BannedFiles:
return True
218 elif fname.endswith(
'.hh')
and os.path.isfile(fname[:-3]+
'.cc'):
224 ''' check if namespace 'ns' should be excluded from generating any bindings.
225 This function also exclude all unrelated folders like .svn
232 'numeric/interpolation',
233 'numeric/interpolation/full',
234 'numeric/interpolation/periodic_range/full',
235 'numeric/interpolation/periodic_range/half',
236 'numeric/interpolation/periodic_range/periodic_value/full',
237 'numeric/interpolation/periodic_range/periodic_value/half',
239 'numeric/model_quality',
241 'core/conformation/signals',
245 'core/fragment/picking/concepts',
246 'core/fragment/picking/vall/eval',
247 'core/fragment/picking/vall/scores',
252 'core/scoring/disulfides',
253 'core/scoring/carbon_hbonds',
255 'core/scoring/hbonds/hbtrie',
256 'core/scoring/dunbrack',
258 'core/scoring/etable',
259 'core/scoring/etable/count_pair',
260 'core/scoring/etable/etrie',
261 'core/scoring/geometric_solvation',
262 'core/scoring/packstat',
263 'core/scoring/packing',
269 'core/io/sequence_comparation',
270 'core/io/serialization',
273 'core/pack/interaction_graph',
274 'core/pack/rotamer_set',
281 'protocols/branch_angle',
282 'protocols/checkpoint',
284 'protocols/comparative_modeling',
287 'protocols/evaluation',
289 'protocols/flexpack',
290 'protocols/flexpack/rotamer_set',
293 'protocols/jd2/archive',
294 'protocols/geometry',
295 'protocols/genetic_algorithm',
296 'protocols/hotspot_hashing',
299 'protocols/looprelax',
301 'protocols/ligand_docking/ligand_options',
303 'protocols/moves/kinematic_closure',
304 'protocols/multistate_design',
305 'protocols/optimize_weights',
306 'protocols/protein_interface_design',
307 'protocols/rbsegment_Moves',
310 'protocols/rna_denovo',
311 'protocols/smanager',
313 'protocols/toolbox/PoseMetricCalculators',
315 'protocols/topology_broker/weights',
317 'protocols/protein_interface_design/movers',
324 'utility/options/keys',
330 if ns.find(
'.svn') >= 0:
return True
334 exclude_header_list = []
344 obj = obj.__getattribute__(a)
352 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
357 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
360 if path ==
'core/pose':
363 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
365 if hfile ==
'core/pose/util.hh':
366 mb.free_function(
"delete_comment").
exclude()
369 if path ==
'core/pose/metrics':
374 if path ==
'core/chemical':
375 try: mb.class_(
"ResidueTypeSet").constructors().
exclude()
376 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
379 if path ==
'core/conformation':
382 if name.find(
'std::map<core::id::StubID,core::kinematics::RT') >= 0:
return True
386 mb.class_(
"Conformation").mem_funs(
'insert_fragment').
exclude()
391 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
393 if hfile==
'core/conformation/Residue.hh':
394 residue = mb.class_(
'Residue' )
395 residue.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
397 if hfile==
'core/conformation/Atom.hh':
398 residue = mb.class_(
'Atom' )
399 residue.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
402 if path ==
'core/fragment':
403 if hfile==
'core/fragment/FragID_Iterator.hh':
404 mb.class_(
"FragID_Iterator").
exclude()
406 if hfile==
'core/fragment/util.hh':
407 mb.free_function(
"flatten_list").
exclude()
409 if hfile==
'core/fragment/FragData.hh':
412 print " access_type:", x.access_type
416 for c
in mb.class_(
"FragData").constructors(
lambda x:
pr(x)):
417 if c.access_type ==
'protected': c.exclude()
426 if path ==
'core/graph':
428 E(
'class_',
"PointGraphVertexData",
'var',
'NUM_EDGES_TO_RESERVE',
'exclude' )
431 if path ==
'core/kinematics':
433 E(
'class_',
"Edge",
'var',
'PEPTIDE',
'exclude')
435 E(
'class_',
"Edge",
'var',
'CHEMICAL',
'exclude')
437 if hfile ==
'core/kinematics/MoveMap.hh':
439 mb.class_(
'MoveMap').mem_funs(
'find').
exclude()
442 if hfile ==
'core/kinematics/FoldTree.hh':
443 cl = mb.class_(
'FoldTree' )
444 cl.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
446 if hfile ==
'core/kinematics/Jump.hh':
448 mb.free_functions(
"distance").
exclude()
452 if path ==
'core/kinematics/tree':
454 E(
'class_',
'BondedAtom',
'member_function',
'clone',
'exclude')
456 E(
'class_',
'JumpAtom',
'member_function',
'clone',
'exclude')
458 if hfile ==
'core/kinematics/tree/Atom.hh':
459 mb.free_functions(
"distance").
exclude()
460 mb.free_functions(
"distance_squared").
exclude()
463 if path ==
'core/pack':
464 if hfile ==
'core/pack/pack_rotamers.hh':
469 mb.free_functions(
"pack_rotamers_run").
exclude()
477 E(
'free_function',
'symmetric_pack_rotamers_run',
'exclude')
480 if path ==
'core/pack/task':
483 mb.class_(
"IGEdgeReweightContainer").mem_funs(
"reweighters_begin").
exclude()
484 mb.class_(
"IGEdgeReweightContainer").mem_funs(
"reweighters_end").
exclude()
486 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
489 if path ==
'core/pack/task/operation':
491 mb.class_(
"ResFilterFactory").mem_funs(
"newResFilter").
exclude()
493 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
495 E(
'class_',
'TaskOperationFactory',
'member_function',
'newTaskOperation',
'exclude')
498 if path ==
'core/import_pose':
499 if hfile==
'core/import_pose/import_pose.hh':
504 if path ==
'core/pose':
511 if path ==
'core/scoring':
513 E(
'class_',
"ResidueNeighborIterator",
'exclude')
515 E(
'class_',
"ResidueNeighborConstIterator",
'exclude')
518 mb.class_(
"ScoreFunction").mem_funs(
"long_range_energies_begin").
exclude()
519 mb.class_(
"ScoreFunction").mem_funs(
"long_range_energies_end").
exclude()
520 mb.class_(
"ScoreFunction").mem_funs(
"cd_2b_intrares_begin").
exclude()
521 mb.class_(
"ScoreFunction").mem_funs(
"cd_2b_intrares_end").
exclude()
522 mb.class_(
"ScoreFunction").mem_funs(
"ci_2b_intrares_begin").
exclude()
523 mb.class_(
"ScoreFunction").mem_funs(
"ci_2b_intrares_end").
exclude()
524 mb.class_(
"ScoreFunction").mem_funs(
"all_energies_begin").
exclude()
525 mb.class_(
"ScoreFunction").mem_funs(
"all_energies_end").
exclude()
527 mb.class_(
"ScoreFunction").mem_funs(
"ci_lr_2b_methods_begin").
exclude()
528 mb.class_(
"ScoreFunction").mem_funs(
"ci_lr_2b_methods_end").
exclude()
529 mb.class_(
"ScoreFunction").mem_funs(
"cd_lr_2b_methods_begin").
exclude()
530 mb.class_(
"ScoreFunction").mem_funs(
"cd_lr_2b_methods_end").
exclude()
532 mb.class_(
"ScoreFunction").mem_funs(
"ws_methods_begin").
exclude()
533 mb.class_(
"ScoreFunction").mem_funs(
"ws_methods_end").
exclude()
535 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
538 mb.class_(
"EMapVector").mem_funs(
"begin").
exclude()
539 mb.class_(
"EMapVector").mem_funs(
"end").
exclude()
540 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
543 mb.class_(
"TwoBodyEMapVector").mem_funs(
"begin").
exclude()
544 mb.class_(
"TwoBodyEMapVector").mem_funs(
"end").
exclude()
545 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
547 if hfile==
'core/scoring/ScoreFunction.hh':
548 scorefnx = mb.class_(
'ScoreFunction' )
549 scorefnx.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
551 if hfile==
'core/scoring/Energies.hh':
552 Energies = mb.class_(
'Energies' )
553 Energies.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
555 if hfile==
'core/scoring/ScoringManager.hh':
556 mb.class_(
"ScoringManager").mem_fun(
"get_DDPLookupTable").
exclude()
559 if path ==
'core/scoring/constraints':
560 E(
'class_',
'CircularHarmonicFunc',
'member_function',
'clone',
'exclude')
561 E(
'class_',
'CircularPowerFunc',
'member_function',
'clone',
'exclude')
562 E(
'class_',
'CharmmPeriodicFunc',
'member_function',
'clone',
'exclude')
564 E(
'class_',
'GaussianFunc',
'member_function',
'clone',
'exclude')
565 try: mb.class_(
'HarmonicFunc').member_function(
'clone').
exclude()
566 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
567 try: mb.class_(
'MixtureFunc').member_function(
'clone').
exclude()
568 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
569 try: mb.class_(
'ScalarWeightedFunc').member_function(
'clone').
exclude()
570 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
572 try: mb.class_(
'BoundFunc').member_function(
'clone').
exclude()
573 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
574 try: mb.class_(
'ConstantFunc').member_function(
'clone').
exclude()
575 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
576 try: mb.class_(
'EtableFunc').member_function(
'clone').
exclude()
577 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
578 try: mb.class_(
'PeriodicBoundFunc').member_function(
'clone').
exclude()
579 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
580 try: mb.class_(
'PeriodicFunc').member_function(
'clone').
exclude()
581 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
583 try: mb.class_(
'MultiConstraint').
exclude()
584 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
585 try: mb.class_(
'Constraint').
exclude()
586 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
589 if path ==
'core/scoring/electron_density':
590 if hfile ==
'core/scoring/electron_density/util.hh':
594 if path ==
'core/scoring/hbonds':
595 if hfile ==
"__core/scoring/hbonds/HBondSet.hh":
597 l = mb.decls(
"get_residue_residue_hbond_energy")
598 for i
in l: i.exclude()
599 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
601 if hfile ==
'core/scoring/hbonds/HBondEnergy.hh':
603 E(
'class_',
"HBondEnergy",
'member_function',
"evaluate_rotamer_pair_energies",
'exclude')
605 if hfile ==
'core/scoring/hbonds/types.hh':
606 mb.free_function(
'HBEval_lookup_initializer').
exclude()
607 mb.var(
'HBEval_lookup').
exclude()
610 if path ==
'core/scoring/rna':
611 E(
'class_',
"RNA_TorsionEnergy",
'member_function',
"indicate_required_context_graphs",
'exclude')
614 if path ==
'core/scoring/methods':
615 try: mb.class_(
'ChainbreakEnergy').member_function(
'clone').
exclude()
616 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
618 try: mb.class_(
'DistanceChainbreakEnergy').member_function(
'clone').
exclude()
619 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
621 try: mb.class_(
'LinearChainbreakEnergy').member_function(
'clone').
exclude()
622 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
624 try: mb.class_(
'MMBondAngleEnergy').member_function(
'indicate_required_context_graphs').
exclude()
625 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
626 try: mb.class_(
'MMTorsionEnergy').member_function(
'indicate_required_context_graphs').
exclude()
627 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
628 try: mb.class_(
'OmegaTetherEnergy').member_function(
'indicate_required_context_graphs').
exclude()
629 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
630 try: mb.class_(
'P_AA_pp_Energy').member_function(
'indicate_required_context_graphs').
exclude()
631 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
632 try: mb.class_(
'RMS_Energy').member_function(
'indicate_required_context_graphs').
exclude()
633 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
634 try: mb.class_(
'DunbrackEnergy').member_function(
'indicate_required_context_graphs').
exclude()
635 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
636 try: mb.class_(
'RamachandranEnergy').member_function(
'indicate_required_context_graphs').
exclude()
637 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
638 try: mb.class_(
'ReferenceEnergy').member_function(
'indicate_required_context_graphs').
exclude()
639 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
640 try: mb.class_(
'WaterAdductHBondEnergy').member_function(
'indicate_required_context_graphs').
exclude()
641 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
642 try: mb.class_(
'WaterAdductIntraEnergy').member_function(
'indicate_required_context_graphs').
exclude()
643 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
648 if path ==
'core/scoring/trie':
649 E(
'class_',
'TrieCollection',
'member_function',
'clone',
'exclude')
652 if path ==
'core/sequence':
653 try: mb.class_(
"L1ScoringScheme").mem_funs(
"clone").
exclude()
654 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
655 try: mb.class_(
"L1ScoringScheme").mem_funs(
"score").
exclude()
656 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
657 try: mb.class_(
"MatrixScoringScheme").mem_funs(
"clone").
exclude()
658 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
659 try: mb.class_(
"MatrixScoringScheme").mem_funs(
"score").
exclude()
660 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
662 try: mb.class_(
"ProfSimScoringScheme").mem_funs(
"clone").
exclude()
663 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
664 try: mb.class_(
"ProfSimScoringScheme").mem_funs(
"score").
exclude()
665 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
667 try: mb.class_(
"SequenceProfile").mem_funs(
"clone").
exclude()
668 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
670 try: mb.class_(
"SimpleScoringScheme").mem_funs(
"clone").
exclude()
671 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
672 try: mb.class_(
"SimpleScoringScheme").mem_funs(
"score").
exclude()
673 except pygccxml.declarations.matcher.declaration_not_found_t:
pass
676 if path ==
'protocols/abinitio':
679 if hfile ==
'protocols/abinitio/ConstraintFragmentMover.hh':
680 mb.class_(
'ConstraintFragmentMover').mem_funs(
"choose_fragment").
exclude()
682 if hfile ==
'protocols/abinitio/KinematicAbinitio.hh':
683 mb.class_(
'JumpingFoldConstraintsWrapper').mem_funs(
"register_options").
exclude()
685 if hfile ==
'protocols/abinitio/KinematicControl.hh':
686 mb.class_(
'KinematicControl').mem_funs(
"remove_chainbreak_variants").
exclude()
692 if path ==
'protocols/branch_angle':
693 mb.free_function(
"bonded_neighbor_all_res").
exclude()
696 if path ==
'protocols/docking':
697 if hfile ==
'protocols/docking/DockingProtocol.hh':
698 mb.class_(
'DockingProtocol').mem_funs(
"show").
exclude()
700 mb.class_(
'DockingProtocol').constructors().
exclude()
707 if hfile ==
'protocols/docking/DockingLowRes.hh':
708 mb.class_(
'DockingLowRes').mem_fun(
"show").
exclude()
711 if path ==
'protocols/dna':
712 mb.class_(
'PDBOutput').operator(
"()").
exclude()
715 if path ==
'protocols/jobdist':
716 if hfile ==
'protocols/jobdist/standard_mains.hh':
717 mb.free_function(
"main_plain_mover").
exclude()
718 mb.free_function(
"main_atomtree_diff_mover").
exclude()
719 mb.free_function(
"main_plain_pdb_mover").
exclude()
722 if path ==
'protocols/ligand_docking':
727 if path ==
'protocols/moves':
728 if hfile ==
'protocols/moves/Mover.hh':
730 mb.class_(
'Mover').member_function(
'parse_my_tag').
exclude()
732 if hfile ==
'protocols/simple_moves/PackRotamersMover.hh':
733 mb.class_(
'PackRotamersMover').member_function(
'run').
exclude()
738 if hfile ==
'protocols/moves/SwitchResidueTypeSetMover.hh':
739 c = mb.class_(
'SwitchResidueTypeSetMover' )
740 c.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
742 if hfile ==
'protocols/moves/ScoreMover.hh':
744 mb.class_(
"ScoreMover").member_function(
'register_options').
exclude()
768 for mf
in c.calldefs(allow_empty=
True):
770 mf.virtuality = pyplusplus.decl_wrappers.declarations.VIRTUALITY_TYPES.NOT_VIRTUAL
771 c._redefined_funcs = []
772 c.is_abstract = c.__WAS_ABSTRACT
773 c.__NEEDS_NO_INIT =
True
774 c.__IS_HACKED_NONVIRTUAL =
True
776 c.constructors(allow_empty=
True,recursive=
False).
exclude()
777 if c.is_wrapper_needed():
778 print "NONVIRTUAL'ized still needs wrapper",c
779 print c.is_wrapper_needed()
785 for c
in mb.classes():
786 for f
in c.constructors(
lambda x: x.access_type ==
'protected', allow_empty=
True):
788 except RuntimeError:
pass
795 for c
in ns.classes(allow_empty=
True,recursive=
False):
796 for f
in c.protected_members: f.exclude()
797 for f
in c.private_members: f.exclude()
798 except RuntimeError:
pass
802 for c
in ns.classes(allow_empty=
True,recursive=
False):
803 for o
in ns.operators(allow_empty=
True,recursive=
False):
804 if o.name ==
'operator<<' and len(o.argument_types) == 2
and \
805 str(o.argument_types[0]) ==
'std::ostream &' and \
806 '::' + str(o.argument_types[1]) == c.decl_string +
' const &':
807 print 'Adding print operator for:', c.decl_string
808 c.add_registration_code(
'def( bp::self_ns::str( bp::self ) )' )
821 for c
in mb.classes():
822 c.__WAS_ABSTRACT = c.is_abstract
823 except RuntimeError:
pass
827 nspath = path.replace(
"/",
"::")
828 nspath = nspath.replace(
"::::",
"::")
830 print "MAKING PACKAGE:",nspath
832 else: ns = mb.global_ns
839 print "Manual excluding:", path
855 for c
in ns.classes(allow_empty=
True,recursive=
False):
856 if c.is_wrapper_needed()
or c.is_abstract:
870 mb._module_builder_t__registrations_code_tail = []
873 print '\nMaking Implicitly convertible:'
875 mb.add_registration_code(
"".
join(ic) )
879 for c
in ns.classes(allow_empty=
True,recursive=
False):
880 if c.decl_string.endswith(
"_"):
881 print "EXCLUDE IMPL_:",c.decl_string
886 for c
in ns.classes(allow_empty=1,recursive=
False):
888 if c.decl_string ==
u'::utility::pointer::ReferenceCount':
continue
893 print 'Abstarct:', c.decl_string
894 if hasattr(c,
'__IS_HACKED_NONVIRTUAL'):
895 c.held_type =
"utility::pointer::owning_ptr< "+c.decl_string+
" >"
896 elif len(c.is_wrapper_needed()) > 0:
900 print "~~ SET HELD TYPE OP",c ,
' exportable?:', c.exportable
901 c.held_type =
"utility::pointer::owning_ptr< "+c.decl_string+
" >"
904 print "SET HELD TYPE OP",c
905 c.held_type =
"utility::pointer::owning_ptr< "+c.decl_string+
" >"
910 for c
in ns.classes(allow_empty=
True):
911 if not c.held_type:
continue
912 if not isinc(c):
continue
913 print 'c.decl_string:', c.decl_string
914 if c.held_type.count(
"utility::pointer::owning_ptr")
and c.decl_string !=
u'::utility::pointer::ReferenceCount':
915 tplt =
"bp::implicitly_convertible< utility::pointer::owning_ptr< %s >\n"
916 tplt +=
" , utility::pointer::owning_ptr< %s > >();\n"
917 ic.append(tplt % ( c.decl_string,c.decl_string+
" const") )
924 if b.decl_string ==
u'::utility::pointer::ReferenceCount':
continue
925 ic.append(tplt % ( c.decl_string,b.decl_string) )
930 for c
in MAKE_SURE_IS_COPYABLE:
932 if c
in ns.classes(allow_empty=
True,recursive=
True):
933 c.noncopyable =
False
937 print 'set_default_call_policies'
938 for f
in mb.calldefs().declarations:
939 f.create_with_signature =
True
941 if not hasattr(f,
'return_type')
or not f.return_type:
continue
944 if hasattr(rtdecl,
'base'):
946 while hasattr(b,
'base'): b = b.base
947 if hasattr(b,
'declaration'): rtdecl = b.declaration
949 if rtbase.endswith(
"const"): rtbase = rtbase[:-5].
strip()
953 if rt.decl_string.endswith(
'&')
and rtbase.split(
"::")[-1]
in (
"Real",
"int",
"float",
"Length",
"long",
"unsigned",
"Size",
"unsigned int",
"long unsigned int",
"size_t",
"string",
"Energy",
"double",
"char",
"DistanceSquared",
"Distance",
"bool",
"TorsionType",
"PackerEnergy"):
954 if rt.decl_string.count(
"const"):
956 f.call_policies = call_policies.return_value_policy( call_policies.copy_const_reference )
959 f.call_policies = call_policies.return_value_policy( call_policies.copy_non_const_reference )
960 elif rt.decl_string.strip().
endswith(
"&")
or rt.decl_string.strip().
endswith(
"*"):
961 if isinstance(rtdecl,pyplusplus.decl_wrappers.enumeration_wrapper.enumeration_t):
962 if rt.decl_string.count(
'const'):
963 f.call_policies = call_policies.return_value_policy( call_policies.copy_const_reference )
965 f.call_policies = call_policies.return_value_policy( call_policies.copy_non_const_reference )
968 f.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
972 for c
in ns.classes(allow_empty=
True,recursive=
False):
973 for f
in c.protected_members: f.exclude()
974 for f
in c.private_members: f.exclude()
978 for c
in ns.classes(allow_empty=
True,recursive=
False):
979 if not c
in nowraper:
continue
980 print "\nEXCLUDE ABSTRACT!!!!!",c,
'\n'
981 if c.is_abstract: c.exclude()
998 for mf
in c.calldefs(allow_empty=
True):
1000 mf.virtuality = pyplusplus.decl_wrappers.declarations.VIRTUALITY_TYPES.NOT_VIRTUAL
1001 c._redefined_funcs = []
1002 c.is_abstract = c.__WAS_ABSTRACT
1003 c.__NEEDS_NO_INIT =
True
1004 c.__IS_HACKED_NONVIRTUAL =
True
1006 c.constructors(allow_empty=
True,recursive=
False).
exclude()
1007 if c.is_wrapper_needed():
1008 print "NONVIRTUAL'ized still needs wrapper",c
1009 print c.is_wrapper_needed()
1016 regex = re.compile(
"^([^<>, :]*)::")
1017 while regex.match(full_name):
1018 ns = regex.search(full_name).group(1)
1021 full_name = regex.sub(
"",full_name)
1022 pth.append(full_name)
1023 pth = [x
for x
in pth
if x]
1028 nspath,cname = path[:-1],path[-1]
1030 for nsname
in nspath:
1031 for tmp
in ns.namespaces(nsname):
1032 if tmp.parent
is ns:
1034 return ns.class_(cname)
1039 for nsname
in nspath:
1041 ns = ns.namespace(nsname,recursive=
False)
1045 for cd
in ns.calldefs(allow_empty=
True):
1046 for arg
in cd.arguments:
1047 if basetype(arg) ==
"basic::Tracer":
1048 if arg.default_value:
1049 print "REMOVING TRACER DEFAULT ARG",arg
1050 arg.default_value =
None
1051 for fv
in ns.vars(recursive=
False,allow_empty=
True):
1052 if basetype(fv) ==
"basic::Tracer":
1054 print "REMOVING TRACER FREE VAR",fv,`fv`
1058 """docstring for basetype"""
1061 if hasattr(t,
'type'): t = t.type
1062 while hasattr(t,
"base"):
1068 ''' return string with includes for finalize2
1076 cc_file = f.replace(
'.hh',
'.cc')
1077 if os.path.isfile(cc_file):
1078 files.append(cc_file)
1081 lines = commands.getoutput(
"cat %s | grep '^#include <core' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1082 + commands.getoutput(
"cat %s | grep '^#include <numeric' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1083 + commands.getoutput(
"cat %s | grep '^#include <utility' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1084 + commands.getoutput(
"cat %s | grep '^#include <protocols' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1085 + commands.getoutput(
"cat %s | grep '^#include <basic' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1086 + commands.getoutput(
"cat %s | grep '^#include <ObjexxFCL' | grep '\.hh\|\.hpp'" % f) +
'\n'
1089 for i
in lines.split(
'\n'):
1093 iname = i[i.index(
'<')+1 : i.index(
'>')]
1094 if os.path.isfile( iname.replace(
'.fwd',
'') ): i = i.replace(
'.fwd',
'')
1096 except ValueError:
pass
1098 output =
'\n'.
join(output)
1101 lines = list( set( output.split(
'\n') ) ); lines.sort()
1102 output =
'\n'.
join( lines ) +
'\n'
1106 def finalize2(fname, dest, path, module_name='_noname', add_by_hand=False, includes=''):
1108 f =
open(fname); s =
'#include <boost/python.hpp>\n' + includes + f.read(); f.close()
1110 namespace = os.path.basename(path)
1111 by_hand = dest +
'/../src/' + path +
'/_' + namespace +
'__by_hand.cc'
1113 if os.path.isfile(by_hand)
and add_by_hand:
1114 print 'Adding by bindings writen by hand...'
1116 s = f.read() +
'\n\n' + s
1124 s = re.sub(
'BOOST_PYTHON_MODULE\(.*\)\{',
1125 'BOOST_PYTHON_MODULE(%(module_name)s){\n wrap__%(n)s__by_hand();' % dict(n=namespace, module_name=module_name),
1128 s = re.sub(
'BOOST_PYTHON_MODULE\(.*\)\{',
1129 'BOOST_PYTHON_MODULE(%(module_name)s){' % dict(n=namespace, module_name=module_name),
1138 def finalize(fname, dest, path, mb, module_name='_noname', add_by_hand=False, files=[], add_includes=True):
1143 output = commands.getoutput(
"cd %s && cat *.cc *.hh | grep '#include <core'" % path)
1145 output += '\n' + commands.getoutput("cd %s && cat *.cc *.hh | grep '#include <protocols'" % path)
1146 output += '\n' + commands.getoutput("cd %s && cat *.cc *.hh | grep '#include <numeric'" % path)
1147 output += '\n' + commands.getoutput("cd %s && cat *.cc *.hh | grep '#include <utility'" % path)
1149 output +=
'\n' + commands.getoutput(
"cd %s && cat *.cc *.hh | grep '#include <protocols\|#include <numeric\|#include <utility' | grep '\.hh'" % path)
1152 if fname.find(
'AmbiguousMultiConstraint.cc') > 0: output +=
'\n#include <core/conformation/Conformation.hh>\n'
1153 if fname.find(
'RotamerTrieBase.cc') > 0:
1154 output +=
'\n#include <core/scoring/etable/EtableEnergy.hh>\n'
1155 output +=
'\n#include <core/scoring/etable/CoarseEtableEnergy.hh>\n'
1156 output +=
'\n#include <core/scoring/hbonds/HBondEnergy.hh>\n'
1157 if fname.find(
'TrieCountPairBase.cc') > 0:
1158 output +=
'\n#include <core/scoring/etable/EtableEnergy.hh>\n'
1159 output +=
'\n#include <core/scoring/etable/CoarseEtableEnergy.hh>\n'
1160 output +=
'\n#include <core/scoring/hbonds/HBondEnergy.hh>\n'
1161 if fname.find(
'EnergyMethod.cc') > 0:
1162 output +=
'\n#include <core/optimization/MinimizerMap.hh>\n'
1163 output +=
'\n#include <core/pack/task/PackerTask.hh>\n'
1164 if fname.find(
'RotamerTrieBase.cc') > 0:
1165 output +=
'\n#include <core/scoring/elec/FA_ElecEnergy.hh>\n'
1166 if fname.find(
'ScoreFunction.cc') > 0:
1167 output +=
'\n#include <core/optimization/MinimizerMap.hh>\n'
1172 if fname.find(
'core/scoring/methods') > 0:
1173 output +=
'\n#include <core/pack/task/PackerTask.hh>\n'
1174 output +=
'\n#include <core/optimization/MinimizerMap.hh>\n'
1176 if fname.find(
'core/scoring/hbonds') > 0:
1177 output +=
'\n#include <core/pack/task/PackerTask.hh>\n'
1179 if fname.find(
'TrieCountPairBase.cc') > 0:
1180 output +=
'\n#include <core/scoring/elec/FA_ElecEnergy.hh>\n'
1182 if fname.find(
'FlexbbIGFactory.cc') > 0:
1183 output +=
'\n#include <core/pack/task/PackerTask.hh>\n'
1195 cc_file = f.replace(
'.hh',
'.cc')
1196 if os.path.isfile(cc_file):
1197 files.append(cc_file)
1201 lines = commands.getoutput(
"cat %s | grep '^#include <core' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1202 + commands.getoutput(
"cat %s | grep '^#include <numeric' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1203 + commands.getoutput(
"cat %s | grep '^#include <utility' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1204 + commands.getoutput(
"cat %s | grep '^#include <protocols' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1205 + commands.getoutput(
"cat %s | grep '^#include <basic' | grep '\.hh\|\.hpp'" % f) +
'\n' \
1206 + commands.getoutput(
"cat %s | grep '^#include <ObjexxFCL' | grep '\.hh\|\.hpp'" % f) +
'\n'
1211 for i
in lines.split(
'\n'):
1214 iname = i[i.index(
'<')+1 : i.index(
'>')]
1215 if os.path.isfile( iname.replace(
'.fwd',
'') ): i = i.replace(
'.fwd',
'')
1218 output =
'\n'.
join(output)
1226 if fname.find(
'IterativeFullatom.cc') > 0:
1227 output +=
'\n#include <protocols/abinitio/PairingStatistics.hh>\n'
1229 if fname.find(
'FASelectSlidingWindowLoopClosure.cc') > 0:
1230 output +=
'\n#include <protocols/evaluation/ConstraintEvaluator.hh>\n'
1234 print "finalize... Build mode 'one file'..."
1235 f = files[0].replace(
'.hh',
'.cc')
1236 if os.path.isfile(f):
1237 output = commands.getoutput(
"cat %s | grep '#include <core'" % f)
1238 output +=
'\n' + commands.getoutput(
"cat %s | grep '#include <protocols'" % f)
1239 output +=
'\n' + commands.getoutput(
"cat %s | grep '#include <numeric'" % f)
1242 lines = list( set( output.split(
'\n') ) ); lines.sort()
1243 output =
'\n'.
join( lines ) +
'\n'
1251 f =
open(fname); s =
'#include <boost/python.hpp>\n' + output + f.read(); f.close()
1253 namespace = os.path.basename(path)
1254 by_hand = dest +
'/../src/' + path +
'/_' + namespace +
'__by_hand.cc'
1256 if os.path.isfile(by_hand)
and add_by_hand:
1257 print 'Adding by bindings writen by hand...'
1259 s = f.read() +
'\n\n' + s
1267 s = re.sub(
'BOOST_PYTHON_MODULE\(.*\)\{',
1268 'BOOST_PYTHON_MODULE(%(module_name)s){\n wrap__%(n)s__by_hand();' % dict(n=namespace, module_name=module_name),
1271 s = re.sub(
'BOOST_PYTHON_MODULE\(.*\)\{',
1272 'BOOST_PYTHON_MODULE(%(module_name)s){' % dict(n=namespace, module_name=module_name),
1294 s = re.sub(
"BOOST_PYTHON_MODULE\(.*\)",
"void wrap"+ns.decl_string.replace(
":",
"_")+
"()",s)
1305 incname = ns.decl_string.strip(
":").replace(
"::",
"__")+
".hh"
1308 s = s.replace(
"protocols::moves::Real",
"core::Real")
1310 pat1 =
r"\(\(const std::allocator<([^<>]+)>\&\)\(\(const std::allocator<\1>\*\)\(\& std::allocator<\1>\(\)\)\)\)"
1311 pat2 =
r" /* REMOVED ((const std::allocator<\1>&)((const std::allocator<\1>*)(& std::allocator<\1>())))*/ "
1312 s = re.sub(pat1,pat2,s)
1323 print 'getting all creators...'
1324 creators = pyplusplus.code_creators.make_flatten(mb.code_creator.creators)
1325 print(
len(creators))
1326 creators = filter(
lambda x: hasattr(x,
'declaration'), creators )
1327 print(
len(creators))
1331 print 'removing CC for',cc.declaration
1332 cc.parent.creators.remove(cc)
1336 print cc.declaration
1341 return not x._ignore
1344 return "utility::pointer::ReferenceCount [class]" in [str(b)
for b
in get_class_bases(c)]
1347 code = re.sub(
r'<unsigned([,>])',
r'<std::size_t\1',code)
1351 while a
and a
is not b: a = a.parent
1357 if isinstance(x,pyplusplus.code_creators.code_creator_t): x = x.declaration
1361 if isinstance(x,pyplusplus.decl_wrappers.namespace_t):
break
1371 if isinstance(x,pyplusplus.code_creators.code_creator_t): x = x.declaration
1375 if isinstance(x,pyplusplus.decl_wrappers.class_t):
break
1386 if hasattr(argcls,
'bases'):
1387 for bi
in argcls.bases:
1388 assert hasattr(bi,
"related_class")
1390 if baseslist
is None:
1392 baseslist.append(argcls)
def make_sure_is_copyable
std::istream & read(std::istream &stream, Fstring &s)
Read from Stream.
def exclude_private_and_protected_members
def exclude_disallowed_virtuals
bool endswith(std::string const &haystack, std::string const &needle)
True iff haystack ends with needle.
def make_implicitly_convertible
Fstring::size_type len(Fstring const &s)
Length.
utility::vector1< std::string > split(const std::string &s)
split given std::string using ' ' symbol.
def remove_tracer_default_args_and_vars
bool open(utility::io::izstream &db_stream, std::string const &db_file, bool warn)
Open a database file on a provided stream.
std::string & strip(std::string &s, std::string const &chars)
Strip Specified Characters from a string's Tails.
def set_default_call_policies
std::string & rstrip(std::string &s, std::string const &chars)
Strip Specified Characters from a string's Right Tail.
def removeProtectedConstructos
def namespace_from_full_path