Commits

pjenvey  committed 87e2a21

replacing the new 'egg_info_dir' template variable with 'egg',
for when just the egg name is needed ('egg' does not include the
'.egg-info' extensinon)

  • Participants
  • Parent commits d25e749

Comments (0)

Files changed (4)

File docs/developer.txt

 into place, potentially with variable substitutions.  Three variables
 are expected: ``project`` is the project name (e.g., ``Project-Name``),
 ``package`` is the Python package in that project (e.g.,
-``projectname``) and ``egg_info_dir`` is the project's .egg-info
-directory name as expected by setuptools (e.g.,
-``Project_Name.egg-info``). Users can add other variables by adding
-``foo=bar`` arguments to ``paster create``.
+``projectname``) and ``egg`` is the project's egg name as expected by
+setuptools (e.g., ``Project_Name``). Users can add other variables by
+adding ``foo=bar`` arguments to ``paster create``.
 
 Filenames are substituted with ``+var_name+``, e.g., ``+package+`` is
 the package directory.

File docs/news.txt

 0.9.1
 ---
 
-* Added the ``egg_info_dir`` template variable: provides projects
-  with a safe .egg-info directory name as expected by setuptools.
-  This should be used instead of ``+project+.egg-info`` to prevent
-  ``paster create`` errors with project names containing hyphens.
+* Added the ``egg`` template variable: provides projects with a safe
+  egg name as expected by setuptools. This should be used for egg-info
+  directories in templates (e.g. ``+egg+.egg-info`` instead of
+  ``+project+.egg-info``), config files (e.g. use = egg:${egg}), and
+  anywhere else the egg name is expected, to prevent errors with
+  project names containing hyphens.
 
 0.9
 ---

File paste/script/create_distro.py

         pkg_name = self._bad_chars_re.sub('', dist_name.lower())
         vars = {'project': dist_name,
                 'package': pkg_name,
-                'egg_info_dir': pluginlib.egg_info_dir('', dist_name),
+                'egg': pluginlib.egg_name(dist_name),
                 }
         vars.update(self.parse_vars(self.args[1:]))
         if self.options.config and os.path.exists(self.options.config):
         elif self.verbose > 1:
             print 'No setup.py (cannot run egg_info)'
 
-        egg_info_dir = os.path.join(output_dir, vars['egg_info_dir'])
+        egg_info_dir = pluginlib.egg_info_dir(output_dir, dist_name)
         for template in templates:
             for spec in template.egg_plugins:
                 if self.verbose:

File paste/script/pluginlib.py

         commands[p.name] = p
     return commands
 
+def egg_name(dist_name):
+    return pkg_resources.to_filename(pkg_resources.safe_name(dist_name))
+
 def egg_info_dir(base_dir, dist_name):
-    # @@: This should be replaced with pkg_resources.to_filename
-    # sometime later (to_filename() did not exist at the time this
-    # function was written).  Probably with setuptools 0.6a10's
-    # release.
-    name = pkg_resources.safe_name(dist_name)
-    name = name.replace('-', '_')
-    return os.path.join(base_dir, name + '.egg-info')
+    return os.path.join(base_dir, egg_name(dist_name) + '.egg-info')