Skip to content

Conversation

@Hierosme
Copy link

@Hierosme Hierosme commented Apr 5, 2022

Here the port of pyOS to python3.

I have use 2to3 and two fixe.

  • Imp lib is deprecated and replace by importlib with the new syntax
  • hashlib require to decode the UTF-8 before anything when get password

Update the README for informe about the python version change and add a exemple about how start and login pyOS

It PR close #4 and #3

@crcollins
Copy link
Owner

Hey, thanks for looking into this. I don’t have any problems with this. The changes looks straightforward enough.

In tinkering with it for a minute, it seems like there are some minor output formatting issues. Though, I am not sure if there are other residual issues (the price you pay for no automated tests, ha!).

$ python2 pyOS.py 
STARTING
root x has permisison for /programs/login.py
user: root
password: 
root x has permisison for /programs/interpreter.py
root@pyOS:/$ ls programs
root x has permisison for /programs/ls.py
root r has permisison for /programs
<out> __pycache__    alias.py       cat.py         cd.py
cp.py          echo.py        edit.py        find.py
grep.py        head.py        help.py        history.py
interpreter.py login.py       ls.py          mkdir.py
mv.py          pwd.py         restart.py     rm.py
sed.py         shutdown.py    tac.py         tail.py
tee.py         touch.py       tree.py        which.py
write.py root@pyOS:/$ shutdown
root x has permisison for /programs/shutdown.py
SHUTTING DOWN  
$ git checkout Hierosme-master 
Switched to branch 'Hierosme-master'
$ python3 pyOS.py 
STARTING
root x has permisison for /programs/login.py
user: root
password: 
root x has permisison for /programs/interpreter.py
root@pyOS:/$ ls programs
root x has permisison for /programs/ls.py
root r has permisison for /programs
<out> __pycache__    alias.py       cat.py         cd.py          cp.py          echo.py        edit.py        find.py        grep.py        head.py        help.py        history.py     interpreter.py login.py       ls.py          mkdir.py       mv.py          pwd.py         restart.py     rm.py          sed.py         shutdown.py    tac.py         tail.py        tee.py         touch.py       tree.py        which.py       write.py root@pyOS:/$ 

I think these stem from slightly different outputs of the print calls from kernel/stream.py:61 (or maybe a bug in programs/ls.py). I didn’t look into it too much though.

Since this whole repo is mostly a hack anyway, I am not sure how much it is worth trying to fix it (or the hundreds of other historical issues).

@hierosme-nova
Copy link

hierosme-nova commented Apr 10, 2022

I have take a look on the formating trouble.
Look like the python3 convertion is the root cause.

Unfortunaly to me i not totaly control/understand what to exactelly the code.
I understand ls make a thing similar to tabulate python module.

during my test i have optain good result with tabulate. But i suppose if it have been code like that, it's for have no dependency.

the only way i see is to recode it part on python3

@hierosme-nova
Copy link

hierosme-nova commented Apr 10, 2022

Unfortunally nothing on the code previoslly write, create the output you have share to me.

I have write some code arround for reproduse something like the result you have share

STARTING
root x has permisison for /programs/login.py
user: root
password: 
root x has permisison for /programs/interpreter.py
root@pyOS:/$ ls
root x has permisison for /programs/ls.py
root r has permisison for /
<out> 
.idea       Design      README.md   __init__.py data        documents   kernel      
 root@pyOS:/$ ls programs
root x has permisison for /programs/ls.py
root r has permisison for /programs
<out> 
__pycache__    alias.py       cat.py         cd.py          cp.py          echo.py        
find.py        grep.py        head.py        help.py        history.py     interpreter.py 
ls.py          mkdir.py       mv.py          pwd.py         restart.py     rm.py          
shutdown.py    tac.py         tail.py        tee.py         touch.py       tree.py        
 root@pyOS:/$ shutdown
root x has permisison for /programs/shutdown.py
SHUTTING DOWN

Fixe typo on access word
@crcollins
Copy link
Owner

Thanks for your patience. I tinkered with this a bit more, and I think you may have it working again. I am not sure about other parts of the system though, so that will need more checks. I will try to test some things and see if there are other issues cause by this change.

Really though, I think my code here is way too buggy to be used. It seems like the last state I left it in was pretty broken. So I am not sure how much you are gaining by trying to reuse this.

@hierosme-nova
Copy link

hierosme-nova commented Apr 16, 2022

No trouble, if it take you too much time i understand.

I Target MicroPython, and you work by it design is very close as my target.
At frist i´ll focus you Stream to sys.stdXX system follow by you Syscall system.

I need a foctional model that is why i would like a pyOS it work.

I confess, you actual work can't be ported like that to MicroPython,
But from my point you syscall system is clearly the way.

Here where i try:
Gitlab: https://gitlab.com/Tuuux/galaxie-shell/-/tree/develop
Wokwi: (Click play, then Ctrl + D to restart the board)
https://wokwi.com/projects/312818372713644610

You'll directlly understand why pyOS must survive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2to3 migration fail

3 participants