Repository: conan-io/conan

Issue:
[bug] ps1 env files for Unix have wrong separators
When making the PR for this change I forgot that Linux uses different separators in environment variables. This means the current setup still does something like ```$env:PATH="foo;bar"``` instead of ```$env:PATH=foo:bar```.



Discussion:

Resolving patch:
diff --git a/conans/client/envvars/environment.py b/conans/client/envvars/environment.py
--- a/conans/client/envvars/environment.py
+++ b/conans/client/envvars/environment.py
@@ -127,8 +127,10 @@ def _format_values(flavor, variables, append_with_spaces):
     :return:
     """
 
-    if flavor in [BAT_FLAVOR, PS1_FLAVOR]:
+    if flavor in [BAT_FLAVOR, PS1_FLAVOR] and platform.system() == "Windows":
         path_sep, quote_elements = ";", False
+    elif flavor == PS1_FLAVOR:
+        path_sep, quote_elements = ":", False
     else:
         path_sep, quote_elements = ":", True
 


Test patch:
diff --git a/conans/test/unittests/client/generators/virtualbuildenv_test.py b/conans/test/unittests/client/generators/virtualbuildenv_test.py
--- a/conans/test/unittests/client/generators/virtualbuildenv_test.py
+++ b/conans/test/unittests/client/generators/virtualbuildenv_test.py
@@ -46,6 +46,13 @@ def test_scripts(self):
         self.assertIn('LDFLAGS="--sysroot=/path/to/sysroot ${LDFLAGS+ $LDFLAGS}"', content)
         self.assertIn('LIBS="${LIBS+ $LIBS}"', content)
 
+        content = self.result["environment_build.ps1.env"]
+        self.assertIn('CPPFLAGS=-DNDEBUG $env:CPPFLAGS', content)
+        self.assertIn('CXXFLAGS=-O3 -s --sysroot=/path/to/sysroot $env:CXXFLAGS', content)
+        self.assertIn('CFLAGS=-O3 -s --sysroot=/path/to/sysroot $env:CFLAGS', content)
+        self.assertIn('LDFLAGS=--sysroot=/path/to/sysroot $env:LDFLAGS', content)
+        self.assertIn('LIBS=$env:LIBS', content)
+
         if platform.system() == "Windows":
             content = self.result["environment_build.bat.env"]
             self.assertIn('CPPFLAGS=-DNDEBUG %CPPFLAGS%', content)
@@ -53,10 +60,3 @@ def test_scripts(self):
             self.assertIn('CFLAGS=-O3 -s --sysroot=/path/to/sysroot %CFLAGS%', content)
             self.assertIn('LDFLAGS=--sysroot=/path/to/sysroot %LDFLAGS%', content)
             self.assertIn('LIBS=%LIBS%', content)
-
-            content = self.result["environment_build.ps1.env"]
-            self.assertIn('CPPFLAGS=-DNDEBUG $env:CPPFLAGS', content)
-            self.assertIn('CXXFLAGS=-O3 -s --sysroot=/path/to/sysroot $env:CXXFLAGS', content)
-            self.assertIn('CFLAGS=-O3 -s --sysroot=/path/to/sysroot $env:CFLAGS', content)
-            self.assertIn('LDFLAGS=--sysroot=/path/to/sysroot $env:LDFLAGS', content)
-            self.assertIn('LIBS=$env:LIBS', content)
diff --git a/conans/test/unittests/client/generators/virtualenv_test.py b/conans/test/unittests/client/generators/virtualenv_test.py
--- a/conans/test/unittests/client/generators/virtualenv_test.py
+++ b/conans/test/unittests/client/generators/virtualenv_test.py
@@ -49,15 +49,18 @@ def test_list_variable(self):
 
         if platform.system() == "Windows":
             self.assertIn("PATH=another_path;%PATH%", self.result["environment.bat.env"])
-            self.assertIn('PATH2=p1;p2;$env:PATH2', self.result["environment.ps1.env"])
+            self.assertIn('PATH2=p1;p2;%PATH2%', self.result["environment.bat.env"])
 
-            self.assertIn("PATH=another_path;%PATH%", self.result["environment.bat.env"])
+            self.assertIn("PATH=another_path;$env:PATH", self.result["environment.ps1.env"])
             self.assertIn('PATH2=p1;p2;$env:PATH2', self.result["environment.ps1.env"])
+        else:
+            self.assertIn('PATH=another_path:$env:PATH', self.result["environment.ps1.env"])
+            self.assertIn('PATH2=p1:p2:$env:PATH2', self.result["environment.ps1.env"])
 
     def test_list_with_spaces(self):
         self.assertIn("CL", VirtualEnvGenerator.append_with_spaces)
         self.assertIn("CL=\"cl1 cl2 ${CL+ $CL}\"", self.result['environment.sh.env'])
-
+        self.assertIn('CL=cl1 cl2 $env:CL', self.result["environment.ps1.env"])
+        
         if platform.system() == "Windows":
             self.assertIn("CL=cl1 cl2 %CL%", self.result["environment.bat.env"])
-            self.assertIn('CL=cl1 cl2 $env:CL', self.result["environment.ps1.env"])
diff --git a/conans/test/unittests/client/generators/virtualrunenv_test.py b/conans/test/unittests/client/generators/virtualrunenv_test.py
--- a/conans/test/unittests/client/generators/virtualrunenv_test.py
+++ b/conans/test/unittests/client/generators/virtualrunenv_test.py
@@ -56,3 +56,8 @@ def test_scripts(self):
             self.assertIn('DYLD_LIBRARY_PATH=lib1;lib2;$env:DYLD_LIBRARY_PATH', content)
             self.assertIn('LD_LIBRARY_PATH=lib1;lib2;$env:LD_LIBRARY_PATH', content)
             self.assertIn('PATH=bin1;bin2;$env:PATH', content)
+        else:
+            content = self.result[self.environment_ps1_env]
+            self.assertIn('DYLD_LIBRARY_PATH=lib1:lib2:$env:DYLD_LIBRARY_PATH', content)
+            self.assertIn('LD_LIBRARY_PATH=lib1:lib2:$env:LD_LIBRARY_PATH', content)
+            self.assertIn('PATH=bin1:bin2:$env:PATH', content)