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

FreezeTool.py: 'mdef' is not defined #721

Closed
ArsThaumaturgis opened this issue Sep 2, 2019 · 7 comments
Closed

FreezeTool.py: 'mdef' is not defined #721

ArsThaumaturgis opened this issue Sep 2, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@ArsThaumaturgis
Copy link
Contributor

@ArsThaumaturgis ArsThaumaturgis commented Sep 2, 2019

As with #720, this was encountered while building a small test-program with a less-than-proper "setup.py" file.

I encountered this error:

Traceback (most recent call last):
  File "setup.py", line 81, in <module>
    'win_amd64'
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/commands.py", line 1414, in run
    self.run_command('build_apps')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/commands.py", line 380, in run
    self.build_runtimes(platform, True)
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/commands.py", line 709, in build_runtimes
    create_runtime(appname, scriptname, False)
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/commands.py", line 639, in create_runtime
    freezer.addModule(incmod)
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/FreezeTool.py", line 1042, in addModule
    guess, fromSource, text))
  File "/home/thaumaturge/.local/lib/python3.6/site-packages/direct/dist/FreezeTool.py", line 1002, in _gatherSubmodules
    fromSource = fromSource, text = text)
NameError: name 'mdef' is not defined

Looking at the indicated code, I think that this is a simple case of a missing "s": a little distance above that line, a variable named "mdefs" is defined, and the same is used elsewhere. However, take that with a grain of salt, as I haven't closely examined the code!

@Moguri

This comment has been minimized.

Copy link
Collaborator

@Moguri Moguri commented Sep 3, 2019

You are correct that this should be mdefs and not mdef. Feel free to submit a PR; I will also add this to my todo list along with all of the other stuff I will "get to eventually."

Do you have an example of a setup.py that can cause this error?

@ArsThaumaturgis

This comment has been minimized.

Copy link
Contributor Author

@ArsThaumaturgis ArsThaumaturgis commented Sep 3, 2019

It looks like an easy way to reproduce it is to have the "setup.py" file specify an "include_module" that doesn't exist. (I don't know whether other means might produce it, too.)

So, presuming that you have an application with a source file named "bugHunt.py", and don't have a module with the pattern "Adventuring.Cutscenes.*", the following should work:

from setuptools import setup

setup(
    name = "Bug Hunt",
    options = {
        "build_apps" : {
            "include_modules" : {
                "*" : ["Adventuring.Cutscenes.*"]
            },
            "gui_apps": {
                "Bug Hunt" : "bugHunt.py"
            },
            "platforms": [
                "manylinux1_x86_64",
            ],
        }
    }
)

As to a pull request... I've generally found those to be a bit of a pain, and I don't relish the idea of dealing with them for the sake of a single-character edit. That said, I am a bit tired and a little bit headachy right now, which may be affecting my mood, so I may reconsider later.

@Moguri

This comment has been minimized.

Copy link
Collaborator

@Moguri Moguri commented Sep 3, 2019

Thanks for the repro case; I'll try to take a look later this week or the weekend.

@ArsThaumaturgis

This comment has been minimized.

Copy link
Contributor Author

@ArsThaumaturgis ArsThaumaturgis commented Sep 3, 2019

Not a problem; it's my pleasure. ^_^

@rdb

This comment has been minimized.

Copy link
Member

@rdb rdb commented Sep 4, 2019

As to a pull request... I've generally found those to be a bit of a pain, and I don't relish the idea of dealing with them for the sake of a single-character edit.

That's fair enough, but note that for simple edits, it's possible to create pull requests via the GitHub web interface by simply clicking the Edit button on a file.

@ArsThaumaturgis

This comment has been minimized.

Copy link
Contributor Author

@ArsThaumaturgis ArsThaumaturgis commented Sep 4, 2019

That's fair enough, but note that for simple edits, it's possible to create pull requests via the GitHub web interface by simply clicking the Edit button on a file.

Ah, that's very good to know--I wasn't aware of that! Thank you for telling me. ^_^

[edit] In that case, I think that I'll go and do that presently--it'll be interesting to try out the feature, for one thing.

[edit 2] And done--and indeed, that was much more painless than previous experiences! Thank you again for introducing me to that. ^_^

ArsThaumaturgis added a commit to ArsThaumaturgis/panda3d that referenced this issue Sep 4, 2019
As per this issue: panda3d#721
@Moguri

This comment has been minimized.

Copy link
Collaborator

@Moguri Moguri commented Sep 6, 2019

Assigning this to myself so I remember to look at and test out the PR.

@Moguri Moguri self-assigned this Sep 6, 2019
@rdb rdb closed this in 73d6c52 Sep 10, 2019
@rdb rdb added this to the 1.10.5 milestone Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.