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

Migrate python scripts to Python3 #124

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zagura
Copy link
Contributor

@zagura zagura commented May 17, 2020

Some scripts are left with python2 shebang. There weren't used in build.
After this changes, I was able to fully build xorp targets on Ubuntu 20.04 with python3.8 and gcc9. Visible problem: libxorp_comm hasn't got correct path, so ldd cannot find it for xorp_rtrtmgr binary.
It seems to be near minimum to get the build working.

@greearb
Copy link
Owner

greearb commented May 17, 2020

Will this still compile on systems that don't have python3? If not, is there any sane way to support both recent python2 and also python3? What about this part of the patch?

#Here's where keyword arguments are applied
apply(env.Replace, (), kwargs)
# apply(env.Replace, (), kwargs)

def AutoTest(env, target, source = None, **kwargs):

I had an attempt to do this in the wip/ patch I committed a few days ago, but of course, not sure it is correct.

@zagura
Copy link
Contributor Author

zagura commented May 17, 2020

No, it won't. Python3 is not backward compatible, so in this form, it is impossible to support Python2. As Python2 is deprecated in 2020, I assumed that any supported system has the capability to run Python3. Probably, keeping 2 versions of scripts in the same file tree wouldn't work as SCons relies on file names and there is no way to support both versions in single file. Another option is to keep different branch with Python2 as Python interpreter for scripts and maintain it until support for it will be abandoned eventually.
As for mentioned code. I have no idea, what it did earlier and it isn't obvious to me, what should be Python3 replacement, so I leave it in this form, it didn't have any "observable" effects.
I don't think that the work to migrate Python script to Python3 is done. Actually, I created this Pull Request, because I saw the WIP commit. After looking briefly into it, I noticed some problems, which I experienced doing the work. It's more a hint that some part of the same job has already been done. I though that this would be some good way to let You know that these commits exist, especially because they have been create around the same time.

@greearb
Copy link
Owner

greearb commented May 18, 2020

I think we should have two branches then, one can be python-3, and the other python2. I still do compiles on old systems (back to Fedora-14 or so), so I will need to support python2 for a while I think.

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

Successfully merging this pull request may close these issues.

2 participants