Closed pahlers closed 11 years ago
Thanks Peter, I'll check the changes against st2. I don't have a license for 3 yet, I'd never bothered to upgrade. — Sent from Mailbox for iPhone
On Tue, Apr 2, 2013 at 7:09 PM, Peter Ahlers (eonlepapillon) notifications@github.com wrote:
Here are changes for ST3. First draft. It kills the version for ST2, so please don't merge. I didn't test it really well. It would be nice if you included a unit test ;-). 'jQuery' and 'ace' downloaded very well. '666' went wrong. I didn't figure out why. Maybe you can.
- Changed for python3 packages
- Added file decode
- Added specific urllib exception You can merge this Pull Request by running: git pull https://github.com/eonlepapillon/sublime-bower st3 Or you can view, comment on it, or merge it online at: https://github.com/benschwarz/sublime-bower/pull/8 -- Commit Summary --
- Changes for ST3 -- File Changes -- M Bower.py (16) -- Patch Links -- https://github.com/benschwarz/sublime-bower/pull/8.patch https://github.com/benschwarz/sublime-bower/pull/8.diff
As you'll note, I totally restructured the codebase — hopefully its a step to making it more maintainable now that I've hacked out that all important first working version.
I'll come back around to trying to implement your changes, or seeing what we can do to make it work in both ST2 & 3 at once.
… at a high level, can you explain why its not working in ST3?
Some packages renamed and/or have other structures:
urllib got another structure: First:
urllib2.urlopen()
urllib2.Request()
Now:
urllib.request.urlopen()
urllib.request.Request()
You can solve these with the next pattern:
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
from StringIO import StringIO
Example:
try:
# Python 3
import urllib.request as req
except ImportError:
# Python 2
import urllib2 as req
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
from StringIO import StringIO
request = req.Request(uri)
respons = req.urlopen(request)
Great. I'll consider all of that and have a go at working on ST3. I downloaded a copy and got started, but right now I'm getting
reloading plugin Bower.Bower
Traceback (most recent call last):
File "/Volumes/Sublime Text/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 72, in reload_plugin
m = importlib.import_module(modulename)
File "X/importlib/__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "/Users/benschwarz/Library/Application Support/Sublime Text 3/Installed Packages/Bower.sublime-package/Bower.py", line 5, in <module>
ImportError: No module named 'bower'
So I'll have to start from there and figure it out.
Thanks so much for your assistance so far!
On Wednesday, 3 April 2013 at 12:44 AM, Peter Ahlers (eonlepapillon) wrote:
Some packages renamed and/or have other structures: package urllib2 become urllib package StringIO become io
urllib got another structure: First:
urllib2.urlopen() urllib2.Request()Now: urllib.request.urlopen() urllib.request.Request()
You can solve these with the next pattern: try: # Python 3 from io import StringIO except ImportError: # Python 2 from StringIO import StringIO
Example: try: # Python 3 import urllib.request as req except ImportError: # Python 2 import urllib2 as req try: # Python 3 from io import StringIO except ImportError: # Python 2 from StringIO import StringIO request = req.Request(uri) respons = req.urlopen(request)
— Reply to this email directly or view it on GitHub (https://github.com/benschwarz/sublime-bower/pull/8#issuecomment-15775658).
I added a st2/3 example.
Legendary! That'll really help a lot - hopefully there won't be too much more to do.
On Wednesday, 3 April 2013 at 12:49 AM, Peter Ahlers (eonlepapillon) wrote:
I added a st2/3 example.
— Reply to this email directly or view it on GitHub (https://github.com/benschwarz/sublime-bower/pull/8#issuecomment-15775916).
ST3 continues to throw either throw module errors that make little sense, or doesn't throw any errors at all (and the plugin isn't seemingly available).
Any help here would be awesome folks
Do you have a branch with the 'error' version?
Here are changes for ST3. First draft. It kills the version for ST2, so please don't merge.
I didn't test it really well. It would be nice if you included a unit test ;-). 'jQuery' and 'ace' downloaded very well. '666' went wrong. I didn't figure out why. Maybe you can.