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

[std/os] split and re-export #20593

Merged
merged 15 commits into from
Oct 20, 2022
Merged

[std/os] split and re-export #20593

merged 15 commits into from
Oct 20, 2022

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Oct 18, 2022

The PR intends to import/reexport std/private/osfiles, std/private/ospaths2, std/private/osdirs, std/private/ossymlinks for std/os module. #20582 should be a simple wrapper around these modules based on type safe definitions.

The APIs for std/paths, std/files, std/dirs and std/symlinks will be refined based on these components. There are not necessarily identical.

@Araq
Copy link
Member

Araq commented Oct 18, 2022

You need to rebase.

from std/envvars import getEnv, existsEnv, delEnv, putEnv, envPairs
from std/os import dirExists, fileExists, walkDir, getAppFilename
from std/os import walkDir, getAppFilename, dirExists, fileExists
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be changed to from std/private/oscommon import dirExists, fileExists in the following PRs because of bootstrapping.

@ringabout ringabout changed the title [std/os] split and export [std/os] split and re-export Oct 19, 2022
@ringabout
Copy link
Member Author

ringabout commented Oct 19, 2022

fwiw, this is an unrelated CI failure

  /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(280, 15) Error: ambiguous call; both measuremancer.*(m: Measurement[*.U], x: T: FloatLike) [proc declared in /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(262, 6)] and measuremancer.*(m: Measurement[*.T], x: T: FloatLike) [proc declared in /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(265, 6)] match for: (T, float)
  stack trace: (most recent call last)

@ringabout ringabout marked this pull request as ready for review October 19, 2022 07:02
@Vindaar
Copy link
Contributor

Vindaar commented Oct 19, 2022

fwiw, this is an unrelated CI failure

  /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(280, 15) Error: ambiguous call; both measuremancer.*(m: Measurement[*.U], x: T: FloatLike) [proc declared in /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(262, 6)] and measuremancer.*(m: Measurement[*.T], x: T: FloatLike) [proc declared in /home/runner/.nimble/pkgs/measuremancer-0.1.1/measuremancer.nim(265, 6)] match for: (T, float)
  stack trace: (most recent call last)

Oh, I had forgotten that measuremancer was implicitly part of the Nim CI via numericalnim. It's still a super rough package and I pushed a change yesterday (but haven't even set up a CI there). I'll fix it up later today.

@Vindaar
Copy link
Contributor

Vindaar commented Oct 19, 2022

I've written some tests, set up a CI for measuremancer and tagged a new version. Rerunning the CI should hopefully work correctly now.

Aside from that, maybe measuremancer would be a useful addition to the Nim CI as it's the only package (I'm aware of at least) that uses --experimental:unicodeOperators in practice?

@ringabout
Copy link
Member Author

ringabout commented Oct 19, 2022

Aside from that, maybe measuremancer would be a useful addition to the Nim CI

Sounds good, it would be better if it is on the nimble packages indexes.

@Vindaar
Copy link
Contributor

Vindaar commented Oct 19, 2022

Aside from that, maybe measuremancer would be a useful addition to the Nim CI

Sounds good, it would be better if it is on the nimble packages indexes.

Oh, I didn't realize I never added it. Will do.

edit: here nim-lang/packages#2392

## * `removeFile proc`_
## * `moveFile proc`_

doAssert card(copyFlagSymlink * options) == 1, "There should be exactly " &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing but terrible API design! Instead of options: set[CopyFlag] it should have been option: CopyFlag!


proc copyFileWithPermissions*(source, dest: string,
ignorePermissionErrors = true,
options = {cfSymlinkFollow}) {.noWeirdTarget.} =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the same design bug.


if not tryMoveFSObject(source, dest, isDir = false):
when defined(windows):
doAssert false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have been raiseOSError or similar.

@Araq Araq merged commit f6a002c into devel Oct 20, 2022
@Araq Araq deleted the pr_files branch October 20, 2022 05:58
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from f6a002c

Hint: mm: orc; opt: speed; options: -d:release
163375 lines; 8.416s; 613.633MiB peakmem

capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
* [std/os] split and export
* move to private modules
* fixes docs and tests

Co-authored-by: xflywind <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants