Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the os module #1175

Open
windelbouwman opened this issue Jul 24, 2019 · 8 comments
Open

Extend the os module #1175

windelbouwman opened this issue Jul 24, 2019 · 8 comments

Comments

@windelbouwman
Copy link
Member

@windelbouwman windelbouwman commented Jul 24, 2019

Currently, the python os module is missing many methods. Try adding a method to this module by editing the file vm/src/stdlib/os.rs.

This is an issue for new contributors, so please do not implement everything at once, so other people have a chance to go for it (or, actually, please implement all! >:)! ).

@mpajkowski
Copy link
Contributor

@mpajkowski mpajkowski commented Jul 25, 2019

Ok, I'm working on get/set uid, guid etc. stuff

@immersinn
Copy link

@immersinn immersinn commented Sep 23, 2019

I'm going to take a stab at chown and chroot.

Also, as a general question, is the current goal to match CPython functionality here?

Currently it doesn't seem that the os module is implemented in C for CPython. Is the goal here to implement the Python os module in Rust as, for example, the sys module in CPython is implemented in C and not in Python?

Or am I completely missing something here?

@coolreader18
Copy link
Contributor

@coolreader18 coolreader18 commented Sep 23, 2019

Because Rust's cross-platform support is so much better than C's, we decided to implement a single _os module that has all the built-in functions rather than the separate posix and nt modules that CPython has.

@immersinn
Copy link

@immersinn immersinn commented Sep 23, 2019

Ah, gotcha..so for chown and chroot methods, i'd reference the functionality and behavior in posixmodule.c

@coolreader18
Copy link
Contributor

@coolreader18 coolreader18 commented Sep 23, 2019

Yep, and you can use the #[cfg(unix)] attribute to make sure they're only available on unix.

@immersinn
Copy link

@immersinn immersinn commented Sep 23, 2019

cool cool, thanks!

@dan-fritchman
Copy link
Contributor

@dan-fritchman dan-fritchman commented Oct 13, 2019

PR #1524 has an implementation of os.system.

@CircleOnCircles
Copy link

@CircleOnCircles CircleOnCircles commented Jan 27, 2020

I would like to do a quick summary of what is API still missing.

  1. os.ctermid
  2. os. environb
  3. os.fchdir
  4. os.fsencode
  5. os.fsdecode
  6. os.PathLike
  7. os.getenvb
  8. os.get_exec_path
  9. os.getgrouplist
  10. os.getgroups partially
  11. os.getlogin
  12. os.getpgrp
  13. os.getpriority

...

I just scroll thought 10% on the os docs. There are still so many interfaces left to implement. 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.