Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

Migrate to python 3.8 #149

Open deathaxe opened 1 week ago

deathaxe commented 1 week ago

How about migrating this package to python 3.8

It requires some adjustments due to updated ruamel-yaml library (see: https://github.com/packagecontrol/channel/pull/12).

juliangarnier commented 18 hours ago

Downloaded JSCustom today, can't get it to work on macos (No module named 'package_control.package_manager'):

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1686, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/juliangarnier/Library/Application Support/Sublime Text/Installed Packages/JSCustom.sublime-package/plugin.py", line 4, in <module>
ImportError: No module named 'package_control.package_manager'

Could this be related to not using Python 3.8?

deathaxe commented 18 hours ago

Yes, Package Control 4 runs on python 3.8. Only package_control.events is being made globally available. package_manager is a private module abused by some plugins.

EDIT: https://github.com/Thom1729/Sublime-JS-Custom/commit/1d27abd908bac3a97a7f1460649688bcf20384fc fixes PC4 incompatibilities, but it seems not having been released yet.

juliangarnier commented 18 hours ago

OK thanks, does it mean it’s not possible to use this package anymore with ST4? Is it possible to downgrade to a compatible version of package manager on macOS? (Can’t find a build anterior to 4)

EDIT: just saw your edit :)

deathaxe commented 18 hours ago

You can wait for next release or temporarily add this repo to PC4 directly.

  1. Open command palette
  2. Call Package Control: Add repository
  3. Paste URL of this repo ( https://github.com/Thom1729/Sublime-JS-Custom)

This will tell PC to install JSCustom from latest master.

It is NOT RECOMMENDED to downgrade Package Control. PC3 is no longer working properly on recent MacOS releases and also starts failing on recent Linux releases.

It's also not PC to blame for other packages abusing it.

juliangarnier commented 17 hours ago

You can wait for next release or temporarily add this repo to PC4 directly.

  1. Open command palette
  2. Call Package Control: Add repository
  3. Paste URL of this repo ( https://github.com/Thom1729/Sublime-JS-Custom)

This will tell PC to install JSCustom from latest master.

Great I managed to get it to run, thank you!

I had to instal both versions, the up to date "Sublime-JS-Custom" and the old "JSCustom" one in order to get it to work though. Without installing the old one, I had this error "The settings file "res://Packages/JSCustom/sublime/JS Custom.sublime-settings" could not be opened"

It appears to work, at least I can see the syntaxes in the status bar, but both are loaded at the same time:

Screenshot 2024-09-22 at 11 45 22

Edit: I manually deleted the old JSCustom.sublime-package, and renamed the new one "JSCustom.sublime-package" and it's now working without having to load both.

deathaxe commented 14 hours ago

I forgot about the method installing package with unmodified repository name.

To fix it, you can add the following name translation to Package Control.sublime-settings

    "package_name_map":
    {
        "Sublime-JS-Custom": "JSCustom",
    },

Ideally, PC would offer an input to configure such custom naming, when adding new git repositories.

Thom1729 commented 13 hours ago

Whoops! When I read the problem, I was sure I'd fixed it — but it doesn't count if I never actually released it. v4.4.0 is out with the patch.

I'm hoping to get some more work done this week.