D7387: packaging: add the config file for PyOxidizer

2019-11-16 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.
mharbison72 abandoned this revision.


  D7450  has the new style config file.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7387/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7387

To: mharbison72, #hg-reviewers
Cc: martinvonz, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7387: packaging: add the config file for PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.
mharbison72 added a subscriber: martinvonz.
mharbison72 planned changes to this revision.


  This isn't meant to be queued.  I posted this to share with @martinvonz , and 
give it better visibility to anyone else interested than an IRC paste.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7387/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7387

To: mharbison72, #hg-reviewers
Cc: martinvonz, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7387: packaging: add the config file for PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the current file I'm using on Mac.  It *seems* like we can get away 
with
  a single config file for all platforms, so this platform agnostic location 
might
  work.  I'm not sure how to `pyoxidizer init .` to setup the other things when
  this file exists.
  
  Things mostly work on Mac, but there are a number of `__file__` references 
that
  need to be worked around, and the templates and default.d config needs to be
  moved to a package so that they can be accessed as resources.
  
  `hg config --debug` shows it looking at an extra config path near the
  executable.  This may be a side effect of being frozen, for py2app support.  
The
  executable is ~33MB, so it would be nice to slim it down.  Especially since
  there are a lot of instances of `__file__` in these unused modules that 
trigger
  build warnings.
  
  I'm not sure what the plans are to test this.  I've been using
  
python3 run-tests --with-hg=/path/to/oxidizedhg
  
  That emits a warning that `--with-hg` should point to an hg script, but it
  seems to surface problems.  The recent work has been mostly in test-help*.
  There are other errors in there when doing this, like get-with-headers.py
  complaining that it can't import `mercurial`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7387

AFFECTED FILES
  contrib/packaging/pyoxidizer/pyoxidizer.toml

CHANGE DETAILS

diff --git a/contrib/packaging/pyoxidizer/pyoxidizer.toml 
b/contrib/packaging/pyoxidizer/pyoxidizer.toml
new file mode 100644
--- /dev/null
+++ b/contrib/packaging/pyoxidizer/pyoxidizer.toml
@@ -0,0 +1,120 @@
+# This file controls the PyOxidizer build configuration. See the
+# pyoxidizer crate's documentation for extensive documentation
+# on this file format.
+
+[[build]]
+application_name = "hg"
+
+[[embedded_python_config]]
+raw_allocator = "jemalloc"
+
+# dont_write_bytecode = true
+# ignore_environment = true
+
+# TODO: enable one or both of these, so that extensions with a separate python
+#   module like mercurial_keyring can load.
+# no_site = true
+# no_user_site_directory = true
+
+
+# optimize_level = 0
+# stdio_encoding = "utf-8:strict"
+
+# Otherwise `hg pull` status is delayed.  No sign of a progress bar either way.
+unbuffered_stdio = true
+# write_modules_directory_env = "PYOXIDIZER_WRITE_MODULES_DIR"
+sys_frozen = true
+# sys_meipass = false
+
+# Windows doesn't support jemalloc.
+[[embedded_python_config]]
+build_target = "i686-pc-windows-msvc"
+raw_allocator = "system"
+
+[[embedded_python_config]]
+build_target = "x86_64-pc-windows-msvc"
+raw_allocator = "system"
+
+[[packaging_rule]]
+type = "stdlib-extensions-policy"
+
+# Package all available extension modules from the Python distribution.
+# The Python interpreter will be fully featured.
+policy = "all"
+
+# Package the entire Python standard library without sources.
+[[packaging_rule]]
+type = "stdlib"
+include_source = false
+
+# Write out license files next to the produced binary.
+[[packaging_rule]]
+type = "write-license-files"
+path = ""
+
+
+# XXX: This doesn't seem to work? (Or at least it still warns about __file__
+#  in these, both when here and if `type = "stdlib"`)
+[[packaging_rule]]
+type = "stdlib-extensions-explicit-excludes"
+excludes = ["setuptools", "pip", "pip._vendor", "distutils", "lib2to3",
+"unittest" ]
+
+
+# NOTE: in order to successfully bundle the C extensions with this, you must
+# `make -C /path/to/hg/repo clean` and touch this file before *each*
+# `pyoxidizer build`.  This also doesn't currently work on Windows- use
+# `type = "virtualenv"` instead.
+[[packaging_rule]]
+type = "setup-py-install"
+package_path = "/Users/mharbison/mercurial_py3"
+include_source = false
+
+
+[[packaging_rule]]
+type = "pip-install-simple"
+package = "hg-evolve==9.2.1"
+include_source = false
+
+
+# TODO: figure out how to convince it to run the hg script in the repo root.
+[[embedded_python_run]]
+mode = "eval"
+code = "import hgdemandimport; hgdemandimport.enable(); from mercurial import 
dispatch; dispatch.run()"
+
+
+
+[[distribution]]
+type = "wix"
+
+# END OF COMMON USER-ADJUSTED SETTINGS.
+#
+# Everything below this is typically managed by PyOxidizer and doesn't need
+# to be updated by people.
+
+[[python_distribution]]
+build_target = "i686-pc-windows-msvc"
+url = 
"https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-windows-x86-20191025T0549.tar.zst";
+sha256 = "388d37bcffee183bc23f5fec9c263779c59d298d35c9e4445b407d95f94db19c"
+[[python_distribution]]
+build_target = "x86_64-apple-darwin"
+url = 
"https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-macos-20191026T0535.tar.zst";
+sha256 = "e8d0710627c017213d9c5c6496577539a5adceb56d3060e07954ce9bf59f39ae"
+[[python_distribution]]
+build_target