[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Hannah von Reth
https://bugs.kde.org/show_bug.cgi?id=429299

Hannah von Reth  changed:

   What|Removed |Added

 Status|REPORTED|RESOLVED
 Resolution|--- |FIXED
   Version Fixed In||2fd56e4fb2423e765f19823edc0
   ||41063e2413809

--- Comment #9 from Hannah von Reth  ---
You are right, thx
https://invent.kde.org/packaging/craft/commit/2fd56e4fb2423e765f19823edc041063e2413809

The code there was a bit dated, from before we had the find function.

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Gary Wang
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #8 from Gary Wang  ---
(In reply to Hannah von Reth from comment #7)
> Hm not at that pint, you could add some print statements to
> https://invent.kde.org/packaging/craft/-/blob/master/craftenv.ps1#L24 
> 
> Like: write-host $py.Source $py.Version

Oh I got it! findPython("python3") and findPython("python") will always got
version 0.0.0.0. Append a line findPython("py") after findPython("python")
works and it can run under both PowerShell 5.1 and PowerShell 7.1 now! Here is
the patch:



diff --git a/craftenv.ps1 b/craftenv.ps1
index 11ffe5221..b2bfb513a 100644
--- a/craftenv.ps1
+++ b/craftenv.ps1
@@ -79,6 +79,7 @@ findPython("python3.7")
 findPython("python3.6")
 findPython("python3")
 findPython("python")
+findPython("py")
 }

 function Global:craft()



Thanks a lot for helping me out!

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Hannah von Reth
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #7 from Hannah von Reth  ---
Hm not at that pint, you could add some print statements to
https://invent.kde.org/packaging/craft/-/blob/master/craftenv.ps1#L24 

Like: write-host $py.Source $py.Version

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Gary Wang
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #6 from Gary Wang  ---
(In reply to Hannah von Reth from comment #5)
> Hmm that looks rather sane.
> 
> And you run D:\CraftRoot\craft\craftenv.ps1 in powershell core?
> (You'll have a to start it explicitly it does not replace the system one)

Yes.

InvalidOperation: D:\CraftRoot\craft\craftenv.ps1:130
Line |
 130 |  (& $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", …
 | ~
 | The expression after '&' in a pipeline element produced an object that
was not valid. It must result
 | in a command name, a script block, or a CommandInfo object.

PS D:\CraftRoot> echo $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-  -  -  --- --
7  1  0


The error message is actually prettier than the one I got from PowerShell 5.1

Is there any log file which I can get so you can get more useful data for
troubleshooting? I know nothing about PowerShell so I don't know where I can
look at for providing more useful information.

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Hannah von Reth
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #5 from Hannah von Reth  ---
Hmm that looks rather sane.

And you run D:\CraftRoot\craft\craftenv.ps1 in powershell core?
(You'll have a to start it explicitly it does not replace the system one)

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Gary Wang
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #4 from Gary Wang  ---
(In reply to Hannah von Reth from comment #3)
> Ok I guess $env:CRAFT_PYTHON is not properly defined.
> Can you check your python install?
> Can you  run "get-command py" "get-command python" "get-command python3" ?
> What do they report.

get-command py

CommandType Name   Version   
Source
---    ---   
--
Application py.exe 3.8.515...
C:\WINDOWS\py.exe


get-command python

CommandType Name   Version   
Source
---    ---   
--
Application python.exe 0.0.0.0   
C:\Users\Gary\AppData\Local\Microsoft\WindowsApps\python.exe


get-command python3

CommandType Name   Version   
Source
---    ---   
--
Application python3.exe0.0.0.0   
C:\Users\Gary\AppData\Local\Microsoft\WindowsApps\python3.exe

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-19 Thread Hannah von Reth
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #3 from Hannah von Reth  ---
Ok I guess $env:CRAFT_PYTHON is not properly defined.
Can you check your python install?
Can you  run "get-command py" "get-command python" "get-command python3" ?
What do they report.

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-18 Thread Gary Wang
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #2 from Gary Wang  ---
(In reply to Hannah von Reth from comment #1)
> Please follow the guide and update your powershell.
> https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/
> Windows#Setting_up_a_powershell

I was using PowerShell 5.1 (according to the wiki page, seems >= 5.0 will be
fine):

echo $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-  -  -  
5  1  19041  610

After upgrade my PowerShell to 7.1.0 by downloading and installing
PowerShell-7.1.0-win-x64.msi following the "In case you need a newer one, we
recommend Powershell Core." link, I still got the same error:

InvalidOperation: D:\CraftRoot\craft\craftenv.ps1:130
Line |
 130 |  (& $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", …
 | ~
 | The expression after '&' in a pipeline element produced an object that
was not valid. It must result
 | in a command name, a script block, or a CommandInfo object.


The "The latest version of the standard powershell can be found here." link
seems outdated, it leads to a page says "Windows Management Framework 5.0
(Superceeded by WMF 5.1 RTM version: http://aka.ms/wmf5download)", also in the
http://aka.ms/wmf5download page, after download and run
W2K12-KB3191565-x64.msu, it says the update is not valid for my computer (not
the original text. I'm not sure what's the original text since I'm not using
English as the system language)


Let me know if you need any other information. Thanks!

-- 
You are receiving this mail because:
You are watching all bug changes.

[Craft] [Bug 429299] launch Craft by running craftenv.ps1 falls on BadExpression error

2020-11-18 Thread Hannah von Reth
https://bugs.kde.org/show_bug.cgi?id=429299

--- Comment #1 from Hannah von Reth  ---
Please follow the guide and update your powershell.
https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows#Setting_up_a_powershell

-- 
You are receiving this mail because:
You are watching all bug changes.