GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — shellpy/shellpython/locator.py at master · lamerman/shellpy

Expand file tree

/

locator.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
35 lines (25 loc) · 1.13 KB
/

locator.py

Copy path

File metadata and controls

35 lines (25 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys
import os.path
def locate_spy_module(module_name):
"""Tries to find shellpy module on filesystem. Given a module name it tries to locate it in pythonpath. It looks
for a module with the same name and __init__.spy inside of it
:param module_name: Filename without extension
:return: Path to shellpy file or None if not found
"""
for python_path in sys.path:
possible_module_path = os.path.join(python_path, module_name)
if os.path.exists(possible_module_path):
if os.path.exists(os.path.join(possible_module_path, '__init__.spy')):
return possible_module_path
return None
def locate_spy_file(file_name):
"""Tries to find shellpy file on filesystem. Given a filename without extension it tries to locate it with .spy
extension in pythonpath
:param file_name: Filename without extension
:return: Path to shellpy file or None if not found
"""
for python_path in sys.path:
possible_file_path = os.path.join(python_path, file_name + '.spy')
if os.path.exists(possible_file_path):
return possible_file_path
return None
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.