@@ -37,7 +37,7 @@ namespace mcp::business {
3737 * @return True if virtual environment is enabled, false otherwise
3838 */
3939 virtual bool use_virtual_env () const = 0;
40-
40+ 4141 protected:
4242 /* *
4343 * Detect Python version by trying common versions from 3.6 to 3.13
@@ -46,23 +46,22 @@ namespace mcp::business {
4646 std::string detect_python_version () const {
4747 // Try common Python versions from 3.13 down to 3.6
4848 static const std::vector<std::string> versions = {
49- " 3.13" , " 3.12" , " 3.11" , " 3.10" , " 3.9" , " 3.8" , " 3.7" , " 3.6"
50- };
51- 49+ " 3.13" , " 3.12" , " 3.11" , " 3.10" , " 3.9" , " 3.8" , " 3.7" , " 3.6" };
50+ 5251 // In a real implementation, we would detect the actual Python version
5352 // For now, we default to "3.9" as a reasonable fallback
5453 // A more sophisticated implementation might check the filesystem or use Python API
5554 return " 3.9" ;
5655 }
57-
56+ 5857#ifdef _MSC_VER
5958 /* *
6059 * Secure way to get environment variable on Windows
6160 * @param name Environment variable name
6261 * @return Environment variable value or empty string if not found
6362 */
64- std::string get_env_var (const char * name) const {
65- char * value = nullptr ;
63+ std::string get_env_var (const char * name) const {
64+ char * value = nullptr ;
6665 size_t len = 0 ;
6766 if (_dupenv_s (&value, &len, name) == 0 && value != nullptr ) {
6867 std::string result (value);
@@ -77,7 +76,7 @@ namespace mcp::business {
7776 * @param name Environment variable name
7877 * @return Environment variable value or nullptr if not found
7978 */
80- const char * get_env_var (const char * name) const {
79+ const char * get_env_var (const char * name) const {
8180 return std::getenv (name);
8281 }
8382#endif
@@ -95,17 +94,17 @@ namespace mcp::business {
9594 // Usually Python is in the PATH, so we can just use "python"
9695 return " python" ;
9796#else
98- return " /usr/bin/python3" ;// Default system Python path
97+ return " /usr/bin/python3" ;// Default system Python path
9998#endif
10099 }
101100
102101 std::string get_python_path () const override {
103102#ifdef _MSC_VER
104103 // On Windows, Python packages are typically available in the PATH
105104 // or can be found relative to the Python executable
106- return " " ;// Empty string means use default Python path
105+ return " " ;// Empty string means use default Python path
107106#else
108- return " /usr/lib/python3/dist-packages" ;// System Python packages path
107+ return " /usr/lib/python3/dist-packages" ;// System Python packages path
109108#endif
110109 }
111110
@@ -141,7 +140,7 @@ namespace mcp::business {
141140 */
142141 class UvEnvConfig : public PythonEnvironmentConfig {
143142 public:
144- explicit UvEnvConfig (const std::string& venv_path) : venv_path_(venv_path) {}
143+ explicit UvEnvConfig (const std::string & venv_path) : venv_path_(venv_path) {}
145144
146145 std::string get_python_interpreter_path () const override {
147146 return venv_path_ + " /bin/python" ;
@@ -181,6 +180,6 @@ namespace mcp::business {
181180 std::mutex cache_mutex_;
182181 };
183182
184- }// namespace mcp::business
183+ }// namespace mcp::business
185184
186185#endif // PYTHON_PLUGIN_INSTANCE_H
0 commit comments