[SOLVED] How to build EventGhost?

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

[SOLVED] How to build EventGhost?

Postby pearbear » Mon Dec 12, 2016 4:25 am

I've found instructions for this in a couple other forum topics:
http://www.eventghost.net/forum/viewtopic.php?t=9475
http://www.eventghost.net/forum/viewtopic.php?t=1611&p=8723#p8723
but these don't seem to be geared towards the system used for the test builds in the EventGhost GitHub repository. The instructions found there say:
just run python Build.py --make-env from an administrative command prompt

Wow, that's it? So easy! Unfortunately it hasn't turned out so simple for me so I'm hoping someone might take pity and give me a bit of help to figure this out.

First of all, obviously you need Python installed and added to your path. But which Python to use? I've tried the version included with EventGhost(py.exe, which is Python Stackless 2.7.9), Python Stackless 2.7.12 32 bit, Python 2.7.12 32 bit, Python 2.7.9 32 bit. All produce the same results.

When I run the build script it proceeds exactly as the successful build logs you can see on GitHub until I get to:
Code: Select all
--- Build lib27
*** searching for required modules ***

At which point it just hangs forever.

I've set the github.user and github.token configuration values.

If I uncheck "Build lib27" in the build options dialog then the build does complete successfully.

The same issue occurred in the automatic appveyor test build of the pull request I submitted to the EventGhost repository(it hangs on the "searching for required modules" until it times out after an hour) but the test build was successful after the PR was merged.

I'd like to submit some more pull requests to the repository but I need to get this working first. I'm sure I'm missing something super obvious but the build instructions should really be more complete. In a perfect world the build script would be a bit more helpful than just hanging without giving much indication of what went wrong.
Last edited by pearbear on Thu Jan 12, 2017 2:06 pm, edited 1 time in total.
pearbear
Experienced User
 
Posts: 103
Joined: Mon Apr 02, 2012 10:28 pm

Re: How to build EventGhost?

Postby kgschlosser » Mon Dec 12, 2016 6:18 am

Have you tried to do a build without virtual env?
Brain Test:
How much dirt is in a hole 2' X 2' X 2' ???
-----------------------------------------------------
Your in a house with an all southern view. You look out a window and see a bear....
What color is it? And why?
User avatar
kgschlosser
Site Admin
 
Posts: 1611
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to build EventGhost?

Postby pearbear » Sat Dec 17, 2016 3:20 am

Sorry for the delayed response. I've been sick and my brain hasn't been up to this level of thought lately.

I have tried running
Code: Select all
python Build.py

with the same result, I assume the --make-env is the virtualenv thing.

As for following all your instructions on http://www.eventghost.net/forum/viewtopic.php?t=9475, I haven't done it because I really don't want to install Visual Studio and I don't see why I should need to do that. If that is necessary then it should definitely be added to the instructions in CONTRIBUTING.md. I'm just going to forget about building EG for now and hopefully more information will be provided at some point in the future. The work I want to do on EG is primarily the documentation and plugins but I'd rather follow the contribution guidelines exactly if possible. I just went ahead and submitted my two pull requests since neither made any changes to the application code. The first built without any errors, the second had a completely different error but apparently it tried again because now it shows that it built successfully.
pearbear
Experienced User
 
Posts: 103
Joined: Mon Apr 02, 2012 10:28 pm

Re: How to build EventGhost?

Postby topix » Sun Dec 18, 2016 8:19 am

pearbear wrote: until I get to:
Code: Select all
--- Build lib27
*** searching for required modules ***

At which point it just hangs forever.

I remember that i had it too, but i can't remeber what was the exact reason why. It is py2exe that is hanging on scanning which (python) modules are needed for bundling.
What i did, was using a debugger and go through the py2exe code until i found the problematic module. Take a look at py2exe/build_exe.py: find_needed_modules()
topix
Experienced User
 
Posts: 284
Joined: Sat May 05, 2007 3:43 pm
Location: Germany

Re: How to build EventGhost?

Postby kgschlosser » Sun Dec 18, 2016 9:28 am

you can try this as well. I know i have run into the same issue or something very similar. but it will not hurt anything anyways

the issue is that the way the code is written for the builder is it scans a specific modules path and any files and or directories is what it uses as module names.

even if the module has a '-' in it. which you cannot do a literal import statement for. and this is of course how the builder does it. it takes the literal file name and then makes a line into a file that is from blah blah import some-module

you can check the file and search it for a '-'

it would be in the _build/data/python27 folder
Imports.py

and if you happen to find an import in there with a '-' in it then you will want to do this

open file _build/builder/BuildImports.py

search for this code
Code: Select all
for package in buildSetup.includeModules:
    outfile.write("\n# modules found for package '%s'\n" % package)
    for module in GetPackageModules(package):
        outfile.write("import %s\n" % module)


and change it to this
Code: Select all
for package in buildSetup.includeModules:
    outfile.write("\n# modules found for package '%s'\n" % package)
    for module in GetPackageModules(package):
        if '-' not in module:
            outfile.write("import %s\n" % module)
Brain Test:
How much dirt is in a hole 2' X 2' X 2' ???
-----------------------------------------------------
Your in a house with an all southern view. You look out a window and see a bear....
What color is it? And why?
User avatar
kgschlosser
Site Admin
 
Posts: 1611
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to build EventGhost?

Postby pearbear » Sun Dec 18, 2016 10:58 am

topix wrote:Take a look at py2exe/build_exe.py: find_needed_modules()

I threw some debug prints into it and determined that it was getting to line 1297:
Code: Select all
mf.import_hook(mod)

with mod == "Import"
and then hung there.

At that point I was stumped as how to continue but I decided to try starting from scratch from a fresh virtual environment. So I just renamed C:\Users\per\Envs\eg-py27 and then ran the build script again and success!!! I've now done a couple builds without any problems. Apparently something went wrong the first time I ran the build script and then I didn't know enough to clear the virtual environment(I was just restarting from a fresh copy of the EG source) so I continued to get the same results every time. I was further sidetracked because the Appveyor build for the pull request I submitted at the same time had the same failure, which made me think it was not something specific to my computer. So I don't know what the exact cause was but maybe this will still be of help to someone else if they run into the same problem. I still have the problematic Envs/eg-py27 folder if anyone wants me to investigate anything further.

So it appears that the instructions in CONTRIBUTING.md are fairly complete but I would like to suggest that there should be an instruction added about installing Python(or maybe using the version included with EG instead?), including which version if a specific one is needed and a link to where to download it from. This stuff is probably obvious to more experienced programmers, who would already have Python installed and in their path, but I think it would be best to make it as easy as possible for anyone to contribute and assume nothing to be obvious.

kgschlosser wrote:you can check the file and search it for a '-'

I did that and didn't find any.

Thanks so much to both of you for your help on this. I think the build script and Appveyor test system that has been created for EventGhost is really fantastic and I very much appreciate the work that has gone into setting it all up. Being able to build EG by just typing "python Build.py --make-env" really lowers the barriers for people like me to be able to contribute or just tinker around with the source without a tremendous effort.
pearbear
Experienced User
 
Posts: 103
Joined: Mon Apr 02, 2012 10:28 pm


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 6 guests