facebookarchive / codemod

Codemod is a tool/library to assist you with large-scale codebase refactors that can be partially automated but still require human oversight and occasional intervention. Codemod was developed at Facebook and released as open source.
Apache License 2.0
4.11k stars 198 forks source link

Windows Support #99

Open calebmeyer opened 6 years ago

calebmeyer commented 6 years ago

I'm trying to use this package on windows. There's no mention of the dependency on curses and fcntl in the readme or in a requirements.txt/Pipfile.

I was able to get curses installed from here, but there's no fcntl on that page.

Here's the call I'm using that's asking for it:

$ codemod --extensions rb --count '(\s+)(get|delete|put)' ''
Traceback (most recent call last):
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\Scripts\codemod-script.py", line 11, in <module>
    load_entry_point('codemod==1.0.0', 'console_scripts', 'codemod')()
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
    return self.resolve()
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\codemod-1.0.0-py3.6.egg\codemod\__init__.py", line 1, in <module>
    from codemod.base import *  # noqa
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\codemod-1.0.0-py3.6.egg\codemod\base.py", line 34, in <module>
    import codemod.terminal_helper as terminal
  File "C:\Users\CM022291\AppData\Local\Programs\Python\Python36\lib\site-packages\codemod-1.0.0-py3.6.egg\codemod\terminal_helper.py", line 11, in <module>
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

Would it be possible to detect windows and use naive terminal handling in that case?