solaris-ips icon indicating copy to clipboard operation
solaris-ips copied to clipboard

setup.py install fails when building repo cloned from Github

Open vladak opened this issue 5 years ago • 2 comments

Trying to build the IPS repo cloned from Github results in exception in pydates:

$ python3.7 ./src/setup.py install
running install
running build
running build_py
Traceback (most recent call last):
  File "/home/vkotal/solaris-ips/src/pydates", line 36, in <module>
    repo = localrepo.instance(myui, cmdutil.findrepo(os.getcwd()), False)
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 2810, in instance
    localpath = util.urllocalpath(path)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 2947, in urllocalpath
    return url(path, parsequery=False, parsefragment=False).localpath()
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 2726, in __init__
    if hasdriveletter(path) or path.startswith('\\\\'):
AttributeError: 'NoneType' object has no attribute 'startswith'

This is because it constructs a Mercurial repository object from cmdutil.findrepo(os.getcwd()). Of course, the repo cloned from Github is Git repo and not a Mercurial repo as the findrepo() expects, therefore it returns None.

vladak avatar Feb 05 '20 15:02 vladak

possible workaround:

diff --git a/src/setup.py b/src/setup.py
index 9b94832b..af247a95 100755
--- a/src/setup.py
+++ b/src/setup.py
@@ -1303,7 +1303,7 @@ class build_py_func(_build_py):
                 self.timestamps = {}
 
                 p = subprocess.Popen(
-                    ["/usr/bin/python2.7", os.path.join(pwd, "pydates")],
+                    ["find", "src/modules", "-maxdepth", "1", "-name", "*.py", "-printf", '%C@ %p\n'],
                     stdout=subprocess.PIPE)
 
                 for line in p.stdout:

Okay, does not contain the . entry.

vladak avatar Feb 05 '20 16:02 vladak

Some forks of this project use a pydate.git python script like this one:

https://github.com/omniosorg/pkg5/blob/master/src/pydates.git

citrus-it avatar Feb 05 '20 16:02 citrus-it