log2zulip: use a Zulip virtualenv if available.
This makes it easier to use log2zulip in a Zulip server environment.
This commit is contained in:
		
							parent
							
								
									515471549e
								
							
						
					
					
						commit
						ede820c9e3
					
				
					 1 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
					@ -1,16 +1,25 @@
 | 
				
			||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python
 | 
				
			||||||
from __future__ import print_function
 | 
					from __future__ import print_function
 | 
				
			||||||
import subprocess
 | 
					
 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import shutil
 | 
					 | 
				
			||||||
import errno
 | 
					import errno
 | 
				
			||||||
import json
 | 
					import os
 | 
				
			||||||
import ujson
 | 
					 | 
				
			||||||
import platform
 | 
					import platform
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					import shutil
 | 
				
			||||||
 | 
					import subprocess
 | 
				
			||||||
import traceback
 | 
					import traceback
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					try:
 | 
				
			||||||
 | 
					    # Use the Zulip virtualenv if available
 | 
				
			||||||
 | 
					    sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
 | 
				
			||||||
 | 
					    import scripts.lib.setup_path_on_import
 | 
				
			||||||
 | 
					except ImportError:
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import json
 | 
				
			||||||
 | 
					import ujson
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../api"))
 | 
					sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../api"))
 | 
				
			||||||
import zulip
 | 
					import zulip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue