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

Wishlist: brew install for MacOS #106

Closed
edreamleo opened this issue Nov 19, 2014 · 11 comments
Closed

Wishlist: brew install for MacOS #106

edreamleo opened this issue Nov 19, 2014 · 11 comments
Assignees
Labels
Delegated Delegatated to others Enhancement Pip Related to distribution

Comments

@edreamleo
Copy link
Member

edreamleo commented Nov 19, 2014

This item has gotten unwieldy. I've moved most notes to leoDist.leo.

@edreamleo edreamleo self-assigned this Apr 3, 2015
@edreamleo edreamleo added this to the 5.1 b2 milestone Apr 3, 2015
@edreamleo edreamleo modified the milestones: 5.1 final, 5.1 b2 Apr 12, 2015
edreamleo added a commit that referenced this issue Apr 24, 2015
@ludwigschwardt
Copy link

ludwigschwardt commented Apr 24, 2015

[The brew commands] assume that you are actually using Homebrew, and normally the Homebrew repo then lives in /usr/local. I normally work in that repo and would then copy the formula elsewhere for pushing (typically to my tap repo).

You don't have to issue a new pull request. Just add your changes to the same branch and push them, and they will remain associated with the same pull request. This is a great feature of the PR: you can commit and discuss until everyone is happy and the PR then gets accepted.

@ludwigschwardt These were very helpful comments. The last time around I created a copy of the entire Homebrew directory in my home directory. As you say, there is no need to do this, and it just adds to the confusion.

edreamleo added a commit that referenced this issue Apr 25, 2015
@edreamleo edreamleo removed this from the 5.1 final milestone Mar 4, 2016
@edreamleo edreamleo reopened this Apr 7, 2016
@edreamleo edreamleo removed their assignment Apr 27, 2016
@edreamleo edreamleo removed the Waiting label Oct 15, 2016
@edreamleo edreamleo modified the milestones: 5.4, 5.5 Oct 15, 2016
edreamleo added a commit that referenced this issue Oct 24, 2016
@edreamleo edreamleo self-assigned this Oct 24, 2016
@edreamleo
Copy link
Member Author

edreamleo commented Oct 25, 2016

Status report: I worked several hours yesterday on a new formula. It may turn out to simple.

The top-level leo-editor folder can go anywhere. There seems to be no need for the formula put the folder in lib/site-customize! Wherever it goes, we want the formula to put a symlink on the desktop (or in the home folder), which when double-clicked will execute python launchLeo.py.

The documentation must tell the user where launchLeo.py is so they can make aliases that open Leo.

@ludwigschwardt
Copy link

Brew already installs all the package files in its cellar in e.g. /usr/local/Cellar/leo/5.4, so I find that the natural place to find the Leo files.

On top of that I would just make launchLeo.py a normal executable script in /usr/local/bin via the Brew machinery, so that the user does not need to know where it is - it's on the path!

The symlink is then an icing on the cake. What about an App-like way to get to launchLeo?

@edreamleo
Copy link
Member Author

@ludwigschwardt Thanks for these comments! Not sure I know enough to put them in action. Here is what I had last night:

class LeoEditor < Formula
  desc "The Leo IDE/Outliner/PIM"
  homepage "http://leoeditor.com/"
  url "https://github.com/leo-editor/leo-editor/archive/5.4.1.tar.gz"
  sha256 "2cf0f598aa46e8ced6dd7da0229157e7b523704d0a03604a4da14b715c0a232f"

  depends_on :python if MacOS.version <= :snow_leopard
  depends_on "pyqt"
  depends_on "enchant" => :recommended

  def install
    python_xy = "python2.7"
    # There is a syntax error somewhere on the next line
    # python_site_packages = lib + "#{python_xy}/site-packages"
    python_site_packages.install "leo"
    bin.install ["launchLeo.py", "profileLeo.py"]
    ln_s "#{bin}/launchLeo.py", "#{bin}/leo"
  end

  test do
    # Create, run in and delete a temporary directory.
    if system "python", "-c", "import", "leo"
      onoe "Leo FAILED"
    else
      ohai "Leo OK"
    end
  end
end

Some questions for you:

  1. How should the formula install Leo in the regular place?
  2. How should the formula create the symlink you suggest?
  3. Is the test section bogus if leo already is installed on the user's system?

I think we may be close.

@edreamleo
Copy link
Member Author

Progress! Just guessing, I changed:

    python_site_packages.install "leo"

to:

    bin.install "leo"

and now the build works:

leo-editor$ brew install leo-editor
...
🍺  /usr/local/Cellar/leo-editor/5.4.1: 2,327 files, 27.7M, built in 5 seconds

More importantly, the following opens Leo:

python /usr/local/Cellar/leo-editor/5.4.1/bin/launchLeo.py

So it seems that question 1 is answered. That still leaves:

  1. How should the formula create the symlink you suggest?
    Maybe the symlink exists in a "regular" spot, but I have no idea what this does:

    ln_s "#{bin}/launchLeo.py", "#{bin}/leo"

  2. Is the test section bogus if leo already is installed on the user's system?

@edreamleo
Copy link
Member Author

edreamleo commented Oct 25, 2016

Maybe the symlink exists in a "regular" spot

Again, just guessing (I'm a complete MacOS noob), I found launchLeo.py in /usr/local/bin Hurray! The following works:

python /usr/local/bin/launchLeo.py

So now we are down to the last question:

Is the test section bogus if leo already is installed on the user's system?

Update: Maybe we can ignore this: the test might be bogus on my system, but it should be valid everywhere else.
Update 2: It's probably possible to ensure that the test refers to the brew version of Leo. In that case, the test should be valid on my machine as well.

We may be getting close to creating a Tap and issuing a PR.

@edreamleo
Copy link
Member Author

@ludwigschwardt Your comments have made everything much clearer.

When running the brew Leo, Leo's log pane shows:

load dir: /usr/local/Cellar/leo-editor/5.4.1/bin/leo/core
global config dir: /usr/local/Cellar/leo-editor/5.4.1/bin/leo/config
home dir: /Users/edward
reading settings in /usr/local/Cellar/leo-editor/5.4.1/bin/leo/config/leoSettings.leo
reading settings in /Users/edward/.leo/myLeoSettings.leo
reading settings in /Users/edward/.leo/workbook.leo

So /usr/local/bin/launchLeo.py actually launches /usr/local/Cellar/leo-editor/5.4.1/bin. At last things are starting to make sense.

Many thanks for your help.

@edreamleo
Copy link
Member Author

edreamleo commented Oct 25, 2016

Before I forget, this homebrew tutorial has been very helpful. I'll be using it next while I try to create the PR.

No, it's pretty confusing about taps and PR's. The following are more helpful:

Now, whenever I have a question I google it. For example, that's where the links above came from.

@ludwigschwardt
Copy link

In my incarnation of the formula I just made launchLeo.py executable and then added a symlink called leo so that I could really just run it on the command line as leo. No need to remember the path to it :-)

I still wonder if we can attach a ".app bundle" or some such thing to turn Leo into a proper app which can then be linked via brew linkapps. Then it will appear in /Applications or ~/Applications like all other GUI apps, which is the least surprising thing to a Mac user (although Homebrew is already off the beaten track...).

@ludwigschwardt
Copy link

A new development...

The pyqt formula and soon the whole Qt4 edifice will be shipping off to the Homebrew boneyard... More info in Homebrew PR #1705. It appears that Qt4 has reached end-of-life in December 2015, nearly a year ago now, and the writing is on the wall. Qt5 is the only option going forward.

Since leo depends on pyqt it will have to move over to pyqt5 in order to get accepted into Homebrew. Not sure how much work that entails, although this page claims the effort is "not great".

@edreamleo
Copy link
Member Author

On Fri, Nov 18, 2016 at 3:12 AM, Ludwig Schwardt notifications@github.com
wrote:

A new development...

The pyqt formula and soon the whole Qt4 edifice will be shipping off to
the Homebrew boneyard... More info in Homebrew PR #1705
Homebrew/homebrew-core#1705. It appears that
Qt4 has reached end-of-life in December 2015, nearly a year ago now, and
the writing is on the wall. Qt5 is the only option going forward.

Since leo depends on pyqt it will have to move over to pyqt5 in order to
get accepted into Homebrew. Not sure how much work that entails, although this
page http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html
claims the effort is "not great".

​There is no effort at all for Leo. Leo can use either Qt4 or Qt5. That's
the purpose of the leo.core.leoQt module.​

Some plugins may not work with Qt4, but that should not affect the homebrew
formula.

Edward

@edreamleo edreamleo removed this from the 5.5 milestone Nov 11, 2017
@edreamleo edreamleo added EKR and removed Important labels Jan 22, 2018
@edreamleo edreamleo added the Pip Related to distribution label Jan 20, 2019
@edreamleo edreamleo added Delegated Delegatated to others and removed EKR labels Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Delegated Delegatated to others Enhancement Pip Related to distribution
Projects
None yet
Development

No branches or pull requests

2 participants