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

Add new Shell Command to support different shells and windows 10 sub linux system #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

pchomik
Copy link
Owner

@pchomik pchomik commented May 8, 2016

Request from issue #19

@pepjo
Copy link

pepjo commented May 8, 2016

Hey! thanks for the implementation :)

I've downloaded the issue branch and linked it into atom. When I start atom I get the following error:

Atom Version: 1.7.3
System: Unknown Windows Version
Thrown From: linter-python package, v2.1.7

Stack Trace

Failed to activate the linter-python package

At Cannot find module 'child-process-es6-promise'

Error: Cannot find module 'child-process-es6-promise'
    at Module._resolveFilename (module.js:338:15)
    at Function.Module._resolveFilename (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (C:/Users/pepjo/Downloads/linter-python-issue19/linter-python-issue19/lib/linter-python.js:5:12)
    at Module._compile (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (C:/Users/pepjo/Downloads/linter-python-issue19/linter-python-issue19/lib/init.js:3:22)
    at Module._compile (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:715:27)
    at Package.module.exports.Package.activateNow (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:173:16)
    at C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:156:32
    at Package.module.exports.Package.measure (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:92:15)
    at C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:149:26
    at Package.module.exports.Package.activate (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package.js:146:34)
    at PackageManager.module.exports.PackageManager.activatePackage (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package-manager.js:538:21)
    at C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package-manager.js:519:29
    at Config.module.exports.Config.transactAsync (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\config.js:337:18)
    at PackageManager.module.exports.PackageManager.activatePackages (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package-manager.js:514:19)
    at PackageManager.module.exports.PackageManager.activate (C:\Users\pepjo\AppData\Local\atom\app-1.7.3\resources\app.asar\src\package-manager.js:497:46)

Commands

Config

{
  "core": {
    "disabledPackages": [
      "linter-gcc",
      "python-tools"
    ],
    "packagesWithKeymapsDisabled": [
      "spell-check"
    ]
  },
  "linter-python": {
    "executablePath": "C:\\Python33\\Scripts\\pylama.exe",
    "withPep257": true
  }
}

Installed Packages

# User
autocomplete-paths, v1.0.2
hex, v0.6.2
keyboard-localization, v1.4.18
language-latex, v0.6.1
language-matlab, v0.2.1
latextools, v0.8.0
linter, v1.11.4
linter-eslint, v7.2.1
linter-matlab, v1.1.0
linter-python, v2.1.7
merge-conflicts, v1.4.2
minimap, v4.23.2
minimap-bookmarks, v0.3.0
minimap-cursorline, v0.1.0
minimap-find-and-replace, v4.5.1
minimap-linter, v1.1.1
minimap-selection, v4.4.0
pdf-view, v0.50.0
pigments, v0.26.0
preview-inline, v1.0.4
project-manager, v2.9.7
react, v0.15.0
release-notes, v0.53.0
sync-settings, v0.7.2

# Dev
No dev packages

@pchomik
Copy link
Owner Author

pchomik commented May 9, 2016

Have you run below commands from inside of downloaded repo?

  • apm link
  • apm install

I found one problem with your request: path handling from windows in linux. I have to read something about new windows future.

@pepjo
Copy link

pepjo commented May 9, 2016

I have linked but not installed, my bad 😭 I've never done this before. I'll try again later.

@pepjo
Copy link

pepjo commented May 9, 2016

I've added the shell command "bash -c" but the plugins throws an error:

Provided path doesn't exist.

pylama

Please fix pylama path.

Pylama path is left blank.

@pchomik
Copy link
Owner Author

pchomik commented May 9, 2016

I made some change in whole concept. Please update the plugin code and

  • select option "linuxOnWindows"
  • please check if palama path looks same in plugin settings and bash console (not windows path) (palama path checking is disabled for testing - I will add support after first positive result)

My assumption is that python and pylama are installed on linux (bash) not in windows. Source code in other hand is available on windows file system.

Please try and let me know.

@pchomik pchomik added this to the 2.2.0 milestone May 10, 2016
@pchomik pchomik self-assigned this May 10, 2016
@pchomik
Copy link
Owner Author

pchomik commented May 13, 2016

@pepjo Could you test last version of branch issue19?

@pepjo
Copy link

pepjo commented May 13, 2016

I had already replyed, I don't know why it's not posted :/

Your assumption is correct, I have pylama installed on linux (although right now I also have it on windows)

I did try the last version and I get an error, either setting a path or not setting it. The error is:

Cannot translate path from Windows to Linux. Please check if linuxOnWindows is unselected.

Also, I've tried to add support for bash to another atom package and I found some wierd problems, you can read about them here: https://github.com/lsegal/atom-runner/issues/139#issuecomment-216037520

@pchomik
Copy link
Owner Author

pchomik commented May 13, 2016

I have to check how atom/javascript are handling paths under Windows.

@pchomik
Copy link
Owner Author

pchomik commented May 17, 2016

Finally I had a time to install Atom under Windows.
I fixed the logic and path should be translated properly.
In case of any problem please enable debug and provide output from dev tool console.
On windows it will be: ctrl + alt + I

@pepjo
Copy link

pepjo commented May 23, 2016

I checked the last version but It doesn't work. And there is no error neither with the red banner in atom or in the atom console. If I check "Linux on Windows" it does nothing, that's all :/

@pchomik
Copy link
Owner Author

pchomik commented May 23, 2016

May I ask you to do one more test. Please select "Linux On Windows" and "debug" and try one more time. You should see many prints in dev tool console.

@pchomik pchomik removed this from the 2.2.0 milestone May 30, 2016
@pchomik
Copy link
Owner Author

pchomik commented May 30, 2016

I will postpone this feature until Windows update appears.

@pepjo
Copy link

pepjo commented May 30, 2016

Ok!

I'm sorry I don't respond as fast I should :(

Maybe it's a bit too late but here is the console log:

linter-python.js:162 [D] >>> Project dir: C:\Users\pepjo\projectes\projecteuler
linter-python.js:37 
linter-python.js:38 [D] >>> -------------------------------------
linter-python.js:39 
linter-python.js:40 [D] >>> Initial parameters
linter-python.js:41 [D] >>>     projectDir = C:\Users\pepjo\projectes\projecteuler
linter-python.js:42 [D] >>>     filePath   = C:\Users\pepjo\projectes\projecteuler\6\main.py
linter-python.js:43 [D] >>>     cmd        = pylama
linter-python.js:192 [D] >>> There is a problem with pylama path: 
 Error: ENOENT: no such file or directory, access 'C:\Users\pepjo\AppData\Local\atom\app-1.7.4\pylama'
linter-python.js:102 [D] >>> Parameters for lint on save
linter-python.js:103 [D] >>>     projectDir = /mnt/c/Users/pepjo/projectes/projecteuler
linter-python.js:
104 [D] >>>     filePath   = /mnt/c/Users/pepjo/projectes/projecteuler/6/main.py
linter-python.js:105 [D] >>>     args       = -l,mccabe,pyflakes,pylint,pep8,pep257,-F,-f,pep8,/mnt/c/Users/pepjo/projectes/projecteuler/6/main.py
linter-python.js:124 [D] >>> Command and arguments for execution
linter-python.js:125 [D] >>>      cmd  = bash
linter-python.js:126 [D] >>>      args = -c,pylama -l mccabe,pyflakes,pylint,pep8,pep257 -F -f pep8 /mnt/c/Users/pepjo/projectes/projecteuler/6/main.py`

@pchomik
Copy link
Owner Author

pchomik commented May 31, 2016

Provided debug log look almost ok. Command should be executed. The problem is why output or error doesn't appear? I'm using external lib to spawn the process. Maybe there is some problem.

For sure I will back to this feature request after windows update. Thanks for tests.

@UndarkAido
Copy link

Is there any progress on this?

@UndarkAido
Copy link

Oh, this is just for linter-python. Darn.

@linickx
Copy link

linickx commented Aug 14, 2017

Hi, Is this still alive?

Initially I installed the latest release from the Atom Package GUI and had an issue with linter-python not accepting "bash -c pylama"; after some googling I found watzon/wsl-proxy and implemented a .bat proxy...

@echo off
bash.exe -c "pylama %*"

This is accepted only as a full path c:\users\nick\bin\pylama.bat but not as either pylama or pylama.bat even though c:\users\nick\bin is in my %PATH%

By accepted I mean that when I save, I don't get an error asking me to correct my pylama path... but what I find is nothing happens, i.e. no lints.

BTW: The batch file works...

C:\Users\nick\Dropbox\python>pylama test_version.py
test_version.py:5:23: E231 missing whitespace after ',' [pycodestyle]
test_version.py:5:25: E231 missing whitespace after ',' [pycodestyle]
test_version.py:5:20: E225 missing whitespace around operator [pycodestyle]
test_version.py:6:3: E111 indentation is not a multiple of four [pycodestyle]
test_version.py:7:3: E111 indentation is not a multiple of four [pycodestyle]
test_version.py:9:23: E231 missing whitespace after ',' [pycodestyle]
test_version.py:9:25: E231 missing whitespace after ',' [pycodestyle]
test_version.py:9:20: E225 missing whitespace around operator [pycodestyle]
test_version.py:10:3: E111 indentation is not a multiple of four [pycodestyle]
test_version.py:11:3: E111 indentation is not a multiple of four [pycodestyle]

C:\Users\nick\Dropbox\python>pylama --linters pylint test_version.py
test_version.py:1:0: C0111 Missing module docstring [pylint]
test_version.py:3:0: C0325 Unnecessary parens after 'print' keyword [pylint]
test_version.py:5:0: C0326 Exactly one space required around comparison if sys.version_info<(2,7,0):                    ^ [pylint]
test_version.py:6:0: W0311 Bad indentation. Found 2 spaces, expected 4 [pylint]
test_version.py:7:0: W0311 Bad indentation. Found 2 spaces, expected 4 [pylint]
test_version.py:9:0: C0326 Exactly one space required around comparison if sys.version_info<(3,0,0):                    ^ [pylint]
test_version.py:10:0: W0311 Bad indentation. Found 2 spaces, expected 4 [pylint]
test_version.py:11:0: W0311 Bad indentation. Found 2 spaces, expected 4 [pylint]

C:\Users\nick\Dropbox\python>

I stumbled across this PR, removed the general release and installed this version, by cloning locally and running apm link and apm install... the install seems to have worked fine as I have the new linux on windows checkbox, my path config is back to the default for pylama but I'm not seeing any improvement... no lint messages.

Any ideas?
Thanks in advance!

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.

4 participants