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

Installation from melpa is broken #9

Open
TauPan opened this issue Apr 4, 2018 · 0 comments
Open

Installation from melpa is broken #9

TauPan opened this issue Apr 4, 2018 · 0 comments

Comments

@TauPan
Copy link

TauPan commented Apr 4, 2018

Hi!

Thanks for pycoverage! Even though the last commit was a while ago, it still works fine on python2/3 and emacs 25.3 with fairly recent coverage versions. Very helpful!

The package pycoverage from melpa installs all files into a flat directory which looks like this:

  ~/.emacs.d/elpa/pycoverage-20160324.1812:
  insgesamt 54
  drwxr-xr-x   3 user group  2048  4. Apr 11:13 .
  drwxr-xr-x 164 user group 16384  4. Apr 11:10 ..
  -rwxr-xr-x   1 user group   231  4. Apr 11:17 cov2emacs
  -rw-r--r--   1 user group  9838  4. Apr 11:07 __init__.py
  -rw-r-----   1 user group 10294  4. Apr 11:12 __init__.pyc
  -rw-r--r--   1 user group   130  4. Apr 11:07 meta.py
  drwxr-x---   2 user group  2048  4. Apr 11:13 __pycache__
  -rw-r--r--   1 user group   653  4. Apr 11:07 pycoverage-autoloads.el
  -rw-r--r--   1 user group  3932  4. Apr 11:07 pycoverage.el
  -rw-r--r--   1 user group  4324  4. Apr 11:07 pycoverage.elc
  -rw-r--r--   1 user group   261  4. Apr 11:07 pycoverage-pkg.el

As a result, starting cov2emacs from that directory fails to load cov2emacslib.

To run the code as packaged from melpa I changed cov2emacs like this:

#!/usr/bin/env python
# Copyright (c) 2009 Matt Harrison
import os
import sys
this_file = os.path.realpath(__file__)
module_dirname = os.path.dirname(this_file)
module_basename = os.path.basename(module_dirname)
elpa_base_dir = os.path.dirname(os.path.join(module_dirname, '..'))
cov2emacs_dir = os.path.join(elpa_base_dir, 'cov2emacslib')
if not os.path.exists(cov2emacs_dir):
    os.symlink(module_dirname, cov2emacs_dir)
sys.path.append(
    os.path.abspath(
        os.path.join(
            elpa_base_dir,
            '..')))
import cov2emacslib

if __name__ == '__main__':
    sys.exit(cov2emacslib.main(sys.argv))

But that won't work with the installation as described in README.md.

Since I have no clue about preparing melpa packages, I just leave this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant