@@ 1562-1592 (lines=31) @@ | ||
1559 | write_to_version_file(target_versionfile, versions) |
|
1560 | cmds["build_py"] = cmd_build_py |
|
1561 | ||
1562 | if "cx_Freeze" in sys.modules: # cx_freeze enabled? |
|
1563 | from cx_Freeze.dist import build_exe as _build_exe |
|
1564 | # nczeczulin reports that py2exe won't like the pep440-style string |
|
1565 | # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. |
|
1566 | # setup(console=[{ |
|
1567 | # "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION |
|
1568 | # "product_version": versioneer.get_version(), |
|
1569 | # ... |
|
1570 | ||
1571 | class cmd_build_exe(_build_exe): |
|
1572 | def run(self): |
|
1573 | root = get_root() |
|
1574 | cfg = get_config_from_root(root) |
|
1575 | versions = get_versions() |
|
1576 | target_versionfile = cfg.versionfile_source |
|
1577 | print("UPDATING %s" % target_versionfile) |
|
1578 | write_to_version_file(target_versionfile, versions) |
|
1579 | ||
1580 | _build_exe.run(self) |
|
1581 | os.unlink(target_versionfile) |
|
1582 | with open(cfg.versionfile_source, "w") as f: |
|
1583 | LONG = LONG_VERSION_PY[cfg.VCS] |
|
1584 | f.write(LONG % |
|
1585 | {"DOLLAR": "$", |
|
1586 | "STYLE": cfg.style, |
|
1587 | "TAG_PREFIX": cfg.tag_prefix, |
|
1588 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, |
|
1589 | "VERSIONFILE_SOURCE": cfg.versionfile_source, |
|
1590 | }) |
|
1591 | cmds["build_exe"] = cmd_build_exe |
|
1592 | del cmds["build_py"] |
|
1593 | ||
1594 | if 'py2exe' in sys.modules: # py2exe enabled? |
|
1595 | try: |
|
@@ 1594-1620 (lines=27) @@ | ||
1591 | cmds["build_exe"] = cmd_build_exe |
|
1592 | del cmds["build_py"] |
|
1593 | ||
1594 | if 'py2exe' in sys.modules: # py2exe enabled? |
|
1595 | try: |
|
1596 | from py2exe.distutils_buildexe import py2exe as _py2exe # py3 |
|
1597 | except ImportError: |
|
1598 | from py2exe.build_exe import py2exe as _py2exe # py2 |
|
1599 | ||
1600 | class cmd_py2exe(_py2exe): |
|
1601 | def run(self): |
|
1602 | root = get_root() |
|
1603 | cfg = get_config_from_root(root) |
|
1604 | versions = get_versions() |
|
1605 | target_versionfile = cfg.versionfile_source |
|
1606 | print("UPDATING %s" % target_versionfile) |
|
1607 | write_to_version_file(target_versionfile, versions) |
|
1608 | ||
1609 | _py2exe.run(self) |
|
1610 | os.unlink(target_versionfile) |
|
1611 | with open(cfg.versionfile_source, "w") as f: |
|
1612 | LONG = LONG_VERSION_PY[cfg.VCS] |
|
1613 | f.write(LONG % |
|
1614 | {"DOLLAR": "$", |
|
1615 | "STYLE": cfg.style, |
|
1616 | "TAG_PREFIX": cfg.tag_prefix, |
|
1617 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, |
|
1618 | "VERSIONFILE_SOURCE": cfg.versionfile_source, |
|
1619 | }) |
|
1620 | cmds["py2exe"] = cmd_py2exe |
|
1621 | ||
1622 | # we override different "sdist" commands for both environments |
|
1623 | if "setuptools" in sys.modules: |