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

OS.hpp removed as unused #660

Merged
merged 2 commits into from
Sep 9, 2019
Merged

OS.hpp removed as unused #660

merged 2 commits into from
Sep 9, 2019

Conversation

breznak
Copy link
Member

@breznak breznak commented Sep 9, 2019

and the code caused problems on Alpine linux.

This header has been (incorrectly) included in many files,
but is not needed.
Removes getMemoryUsage method which has been exported to python,
but apparently also never used.

Fixes #659
For #175

and the code caused problems on Alpine linux.

This header has been (incorrectly) included in many files,
but is not needed.
Removes `getMemoryUsage` method which has been exported to python,
but apparently also never used.
@breznak breznak added this to the cleanup milestone Sep 9, 2019
@breznak breznak self-assigned this Sep 9, 2019
Copy link
Member Author

@breznak breznak left a comment

Choose a reason for hiding this comment

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

Best type of fixing an error, by removing the whole file(s).
The functionality of OS was working, but never used. If deeped required, I can just fix the compile for Alpine.
But I think pruning the unused code is a better option, esp. since this is a support code, not mandatory for us.

bindings/py/cpp_src/bindings/engine/py_OS.cpp Show resolved Hide resolved

#else
char * s = ::getcwd(buff, PATH_MAX - 1);
NTA_CHECK(s != nullptr) << OS::getErrorMessage();
NTA_CHECK(s != nullptr) << "getcwd failed!";
Copy link
Member Author

Choose a reason for hiding this comment

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

simplified behavior, but only in test and I don't think it's worth keeping that functionality.

@breznak breznak added the ready label Sep 9, 2019
Copy link
Collaborator

@ctrl-z-9000-times ctrl-z-9000-times left a comment

Choose a reason for hiding this comment

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

This looks fine to me. All of these functions are clearly outside of the scope of this library, and are not needed for it.

OS functions which were already removed from NuPIC:

  • getHostname
  • getUserNTADir
  • setUserNTADir
  • getProcessID
  • getTempDir
  • makeTempFilename
  • sleep
  • executeCommand
  • genCryptoString
  • verifyHostname
  • isProcessAliveWin32
  • killWin32
  • getStackTrace

OS functions removed by this PR:

  • getErrorMessage
  • getLastErrorCode
  • getErrorMessageFromErrorCode
  • getHomeDir
  • getUserName
  • getProcessMemoryUsage
  • executeCommand

@breznak
Copy link
Member Author

breznak commented Sep 9, 2019

Nice compilation of the removed methods, and thanks for the review!

TODO:
possible candidates for further removal: os/Path,Directory,Env.hpp
In python we have a library for that, if c++ can avoid the out-of-scope code too (?)

@breznak breznak merged commit fe4f67a into master Sep 9, 2019
@breznak breznak deleted the fix_alpine_build branch September 9, 2019 15:51
@dkeeney
Copy link

dkeeney commented Sep 9, 2019

possible candidates for further removal: os/Path,Directory,Env.hpp

Path and Directory can be removable when all compilers support std::filesystem.

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

Successfully merging this pull request may close these issues.

build error in python-alpine
3 participants