File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change 1+ import  sys 
12from  subprocess  import  check_output 
23from  pathlib  import  Path 
3- import  postgresql 
44
5- pg_bin  =  Path (postgresql . __file__ ).parent  /  "bin" 
5+ pg_bin  =  Path (__file__ ).parent  /  "bin" 
66
77
8- def  initdb (cmdline ):
9-     cmdline  =  str (pg_bin  /  "initdb" ) +  " "  +  cmdline 
10-     return  check_output (cmdline , shell = True )
8+ def  prog (name ):
9+     def  f (cmdline ):
10+         cmdline  =  str (pg_bin  /  name ) +  " "  +  cmdline 
11+         return  check_output (cmdline , shell = True )
1112
13+     return  f 
1214
13- def  pg_ctl (cmdline ):
14-     cmdline  =  str (pg_bin  /  "pg_ctl" ) +  " "  +  cmdline 
15-     return  check_output (cmdline , shell = True )
15+ 
16+ progs  =  """ 
17+ clusterdb          ecpg               pg_checksums       pg_dumpall         pg_restore         pg_verifybackup    reindexdb 
18+ createdb           initdb             pg_config          pg_isready         pg_rewind          pg_waldump         vacuumdb 
19+ createuser         pg_archivecleanup  pg_controldata     pg_receivewal      pg_test_fsync      postgres 
20+ dropdb             pg_basebackup      pg_ctl             pg_recvlogical     pg_test_timing     postmaster 
21+ dropuser           pgbench            pg_dump            pg_resetwal        pg_upgrade         psql 
22+ """ .split ()
23+ 
24+ 
25+ this  =  sys .modules [__name__ ]
26+ for  p  in  progs :
27+     setattr (this , p , prog (p ))
1628
1729
1830from  . import  _version 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments